Module 12: Introduction to R Markdown
Github Repository: AustinTCurtis/r-programming-assignments
This week, I learned how R Markdown combines plain text, code, and mathematical notation into one cohesive document. Markdown syntax makes it easy to structure reports using headings, lists, bold or italic text, and hyperlinks, while LaTeX provides a clean way to display mathematical expressions both inline (e.g., $\alpha + \beta = \gamma$) and in block form.
I found that code chunks and narrative sections integrate seamlessly. Each R code block runs automatically during knitting, and the results appear directly below the explanations. This helps ensure transparency and reproducibility anyone can see both the code and its output together in context.
One of the main challenges I faced was understanding the correct placement of code chunks and ensuring they were surrounded by triple backticks ```{r} at first, my math syntax didn’t render properly, and my code didn’t execute because I had written it outside the chunks. Once I learned how to separate Markdown text from R code, the document knitted smoothly into HTML, showing all the analysis and visualizations as expected.
Overall, this exercise helped me appreciate how R Markdown supports reproducible analysis while producing professional-looking reports with minimal effort.
HTML FILE BELOW:
My R Markdown Primer
Austin Curtis
2025-11-11
##Introduction ##Text, code, and graphics can all be included in a single file using the R Markdown document format. It facilitates repeatable analysis by allowing you to describe your work while displaying your actual code and outcomes. Once knitted, the document can be converted to Word, PDF, or HTML to create a polished, legible report.
##Narrative ##It is simple to incorporate structured text with executable R code when using R Markdown. This means that the analysis and its justification coexist in a single process rather than being copied and pasted into a different report. This enhances productivity, precision, and openness, particularly in academic research or data science.
##Math Expression
##Load a Library/Dataset
summary(cars)## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00data("mtcars")
summary(mtcars)## mpg cyl disp hp
## Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0
## 1st Qu.:15.43 1st Qu.:4.000 1st Qu.:120.8 1st Qu.: 96.5
## Median :19.20 Median :6.000 Median :196.3 Median :123.0
## Mean :20.09 Mean :6.188 Mean :230.7 Mean :146.7
## 3rd Qu.:22.80 3rd Qu.:8.000 3rd Qu.:326.0 3rd Qu.:180.0
## Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0
## drat wt qsec vs
## Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000
## 1st Qu.:3.080 1st Qu.:2.581 1st Qu.:16.89 1st Qu.:0.0000
## Median :3.695 Median :3.325 Median :17.71 Median :0.0000
## Mean :3.597 Mean :3.217 Mean :17.85 Mean :0.4375
## 3rd Qu.:3.920 3rd Qu.:3.610 3rd Qu.:18.90 3rd Qu.:1.0000
## Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000
## am gear carb
## Min. :0.0000 Min. :3.000 Min. :1.000
## 1st Qu.:0.0000 1st Qu.:3.000 1st Qu.:2.000
## Median :0.0000 Median :4.000 Median :2.000
## Mean :0.4062 Mean :3.688 Mean :2.812
## 3rd Qu.:1.0000 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :1.0000 Max. :5.000 Max. :8.000##Generate a plot
library(ggplot2)
ggplot(mtcars, aes(x = wt, y = mpg)) +
geom_point(color = "steelblue") +
labs(
title = "Miles per Gallon vs. Weight",
x = "Weight (1000 lbs)",
y = "Miles per Gallon"
)##Reflection
##All things considered, R Markdown offers a smooth method of combining writing, analysis, and code. In contrast to traditional reports, it guarantees that your data and findings are always current because your analysis is immediately replicated each time you re-knit the file. Once I figured out how to format chunks correctly, I discovered that combining Markdown syntax, LaTeX math, and R code was simple. It's a useful tool for producing transparent, thoroughly recorded work.
Comments
Post a Comment