My First Quarto Document
Report of Lab 01
An example of generating a report using R, RStudio and Quarto. The goal of this report is to:
- Generate a simple report of Lab 01
- Include the R code from Lab 01
Code from Lab 01
First, we read the file so it can be accessed in the rest of the code:
iris <- read.csv("iris.csv", stringsAsFactors = TRUE)
Then, we print some basic statistics of the data, including mean, range, and standard deviation, while printing the name of each statistic before printing the result:
print("mean")
print(mean(iris$Sepal.Width))
print("s.d")
print(sd(iris$Sepal.Width))
print("range")
print(range(iris$Sepal.Width))
Next, we produce a plot of Petal Length vs Petal Width for all different species of Iris in the data set:
plot(iris$Petal.Length, iris$Petal.Width, pch=16, col=as.factor(iris$Species))
Finally, we make an equation to estimate the petal area and save it onto our data set:
iris$Petal.Area = pi * iris$Petal.Length * iris$Petal.Width
write.csv(iris, "iris2.csv", row.names = FALSE)