<p>Example One</p><p># Table 3.1</p><p>> tb3dot1<-read.table("E:/teach/www/SubPages/CSUteach/st3502/Ott6ed-data/Ott- 6ed_data_txt/RS/ch3resarchstudy.txt",na.strings=".",header=T) > colnames(tb3dot1)[5]<-"Minority_pcnt" > colnames(tb3dot1)[6]<-"Poverty_pcnt" > third.math<-tb3dot1$Math[1:22] > third.reading<-tb3dot1$Reading[1:22] > cor(third.math, third.reading)</p><p># drawing polts</p><p>> plot(third.math,third.reading,main="Math vs. Reading for 3rd Grad") > stem(third.math) > stripchart(third.math, method="stack",pch=19, main="3rd Grade Math Score") > boxplot(tb3dot1$Math) > boxplot(tb3dot1$Math~tb3dot1$Grade) > boxplot(tb3dot1$Math~tb3dot1$Grade, main="Math vs. Grade")</p><p>Example Two</p><p># generate data</p><p>> x<-rnorm(17) > y<-rbinom(17,10,.5) > time<-2000:2016 > sex<-c(rep("M",8),rep("F",9)) > group<-c(rep(c("A","B","C"),5),"A","B")</p><p># drawing plots</p><p>> plot(time,y,type="l", main="time series plot") > plot(x,y,main="scatter plot") > cor(x,y) > boxplot(x~sex, main="side-by-side boxplot")</p><p>> barplot(table(sex), main="bar chart") > pie(table(sex), main="pie chart")</p><p>> counts<-table(group,sex) > barplot(counts,xlab="Sex",ylab="Frequency",ylim=c(0,15),legend=rownames(count s),main="Stacked bar chart")</p><p># numerical summary</p><p>> summary(x) > quantile(x,.90) > IQR(x) > sd(x)</p>
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages1 Page
-
File Size-