data(iris) summary(iris[iris$Species == “setosa”,2]) summary(iris[iris$Species == “versicolor”,2]) summary(iris[iris$Species == “virginica”,2])
data(mtcars) mtcars\(cyl2 <- as.factor(mtcars\)cyl) boxplot(mpg~cyl2,data=mtcars,xlab=“Number of Cylinders”, ylab=“Miles per Gallon” )
repl <- replicate(1000, rnorm(100, 10, 5)) sample_mean <- apply(repl, 2, mean) mean(sample_mean) sd(sample_mean) #The mean and standard deviation are within a range that is close enough to the actual mean and standard deviation of sd/sqrt(n) in order for our results to be consistent with the central limit theorem.
geese = read.csv(“U:/Public/Data/geese.txt”) Aest = (log(geese\(Aestimate)) Best = (log(geese\)Bestimate)) par(mfrow=c(1,2)) hist(Aest) hist(Best)
header=FALSE sugar_1979 = read.csv(“U:/Public/Data/CerealSugar1979.csv”) sugar_2006 = read.csv(“U:/Public/Data/CerealSugar2006.csv”) names(sugar_1979)[1] = “Cereal” names(sugar_1979)[2] = “Sugar_Content” names(sugar_2006)[1] = “Cereal” names(sugar_2006)[2] = “Sugar_Content” t.test(sugar_1979\(Sugar_Content,sugar_2006\)Sugar_Content) #p-value is well over .05. Thus, we must fail to reject the null hypothesis
retail = read.table(“U:/Private/Data 315/retail.txt”) lm(formula = retail\(Gross-Sales~retail\)Gross-Cash+retail\(Cash-Items+retail\)Gross-Check, data = retail)
kudzu = read.table((“U:/Public/kudzu.txt”),header=TRUE) results = aov(BMD~Treatment, data = kudzu) summary(results)
getdata = read.csv(“U:/Public/Data/getdata_data_ss06hid.csv”) which = which(getdata$VAL == 24) observations = length(which) print(observations)
mondial = read.csv(“U:/Private/Data 315/Mondial Data.csv”) density = (log(mondial\(Population/mondial\)Area)) hist(density, xlab = “Logarithm of the density of every country”)
mondial2 = read.csv(“U:/Private/Data 315/Mondial Data.csv”) library(maps) map() longitude = as.numeric(levels(mondial2\(longitude)[mondial2\)longitude]) latitude = as.numeric(levels(mondial2\(latitude)[mondial2\)latitude]) points(longitude, latitude)