Complete the following using R: (Please submit the R code and add comments) The
ID: 3666045 • Letter: C
Question
Complete the following using R: (Please submit the R code and add comments) The dataset is available on blackboards Dataset rightarrow R Class Datasets Read the dataset Density.csv into R and store it in Densldata. Create a subset dataset that includes observations for Sites 1 through 10 only and name it Density10. Create a subset dataset that includes observations for Sites 11 through 20 only and name it Density20. Create a subset dataset that includes observations for Sites 21 through 30 only and name it Density30. For the Densldata, report the summary statistics for each variable taking into account the type of each variable. For each of the datasets Densldata, Density10, Density20, and Density30, consider the variable Dens and create a histogram. Make sure to add an informative title and labels. Create a boxplot for the variable Dens, considering Density10, Density20, and Density30. Make sure to add an informative title and labels.Explanation / Answer
# your code goes here
Dens1data <- read.table("Density.csv", header=TRUE, sep=",")
Density10 <-subset(Dens1data, site<=10)
Density20 <-subset(Dens1data, site<=20)
Density30 <-subset(Dens1data, site<=30)
summary(Dens1data)
hist(Density10$Dens,main="Distribution of Density",xlab="Dens")
hist(Density20$Dens,main="Distribution of Density",xlab="Dens")
hist(Density30$Dens,main="Distribution of Density",xlab="Dens")
boxplot(Density10$Dens, main='Box plot for Density',
xlab='Density',
horizontal=TRUE)
boxplot(Density20$Dens, main='Box plot for Density',
xlab='Density',
horizontal=TRUE)
boxplot(Density30$Dens, main='Box plot for Density',
xlab='Density',
horizontal=TRUE)