5 + 6[1] 11
A first example of generating a report using R, RStudio and Quarto. The goal of this report is to:
Quarto is super dope becuase you can use it to display code from R and its results. Here’s some simple addition from R:
5 + 6[1] 11
And here’s a data set summary made using R:
giss = read.csv("giss_temp.csv")
summary(giss) Year Month DecDate TempAnom
Min. :1881 Min. : 1.00 Min. :1881 Min. :-0.860000
1st Qu.:1913 1st Qu.: 3.75 1st Qu.:1914 1st Qu.:-0.210000
Median :1946 Median : 6.50 Median :1946 Median :-0.050000
Mean :1946 Mean : 6.50 Mean :1946 Mean :-0.009428
3rd Qu.:1979 3rd Qu.: 9.25 3rd Qu.:1979 3rd Qu.: 0.150000
Max. :2011 Max. :12.00 Max. :2012 Max. : 0.880000
R can also be used to process data by calculating means and creating vectors:
annualTemp = tapply(giss$TempAnom, giss$Year, mean)
years = unique(giss$Year)And R is also quite nice for making graphs. Here is a histogram made from the above data…
hist(giss$TempAnom, breaks=20)…and here is a line plot of annual temperatures.
plot(years, annualTemp, type='l', lwd=2, col=2,
xlab="Years", ylab="Temp Anom")
abline(h=0, lty=2)If, perchance, I wanted to be a little secretive about the results of a certain bit of code, I could also hide it from you:
plot(years, annualTemp, type='l', lwd=2, col=2,
xlab="Years", ylab="Temp Anom")
abline(h=0, lty=2)I can also be even more secretive by hiding the code and only showing you the result, as with this example from the histogram above:
This has been my first report developed using R and Quarto. Have a splendid day