Copyright (C) 2016 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. [Previously saved workspace restored] > setwd("H:\") + > setwd("H:/") > read.table("H:/ST104-Pulse.txt",header=T) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'H:/ST104-Pulse.txt': No such file or directory > read.table("H:/Pulse.txt",header=T) Pulse1 Pulse2 Smokes Sex Height Weight 1 96 140 2 1 164 56 2 62 100 2 2 150 45 3 78 104 1 1 149 41 4 82 100 2 2 168 57 5 100 115 1 2 157 51 6 68 112 2 2 171 67 7 96 116 2 1 174 69 8 78 118 2 2 152 48 9 88 110 1 1 169 61 10 62 98 1 2 159 58 11 80 128 2 1 175 63 > df1<-read.table("H:/Pulse.txt",header=T) > df1<-read.table("H:/Pulse1.txt",header=T) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'H:/Pulse1.txt': No such file or directory > df2<-read.table("H:/Pulse1.txt",header=T) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'H:/Pulse1.txt': No such file or directory > dd1<-read.table("H:/Pulse.txt",header=T) > dd[ ,5] Error: object 'dd' not found > dd[ 2,5] Error: object 'dd' not found > dd1[ 2,5] [1] 150 > dd1[,5] [1] 164 150 149 168 157 171 174 152 169 159 175 > dd1$Height [1] 164 150 149 168 157 171 174 152 169 159 175 > mean(dd1$Height) [1] 162.5455 > SD(dd1$Height) Error: could not find function "SD" > SD(Height) Error: could not find function "SD" > SD(dd1$Height) Error: could not find function "SD" > S(dd1$Height) Error: could not find function "S" > Sd(dd1$Height) Error: could not find function "Sd" > Sd(Height) Error: could not find function "Sd" > sd(Height) Error in is.data.frame(x) : object 'Height' not found > sd(dd1$Height) [1] 9.626668 > sd(Height) Error in is.data.frame(x) : object 'Height' not found > sd(dd1$Height) [1] 9.626668 > mean(Pulse1) Error in mean(Pulse1) : object 'Pulse1' not found > attach(df1) > mean(Height) [1] 162.5455 > attach(Pulse1) Error in attach(Pulse1) : 'attach' only works for lists, data frames and environments > summary(HEeight) Error in summary(HEeight) : object 'HEeight' not found > summary(Height) Min. 1st Qu. Median Mean 3rd Qu. Max. 149.0 154.5 164.0 162.5 170.0 175.0 > > > summary(Weight) Min. 1st Qu. Median Mean 3rd Qu. Max. 41.0 49.5 57.0 56.0 62.0 69.0 > > > read.table("H:/children.txt",header=T) Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'H:/children.txt': No such file or directory > read.table("H:/children.txt",header=T) height gender edu 1 90.2 M AL 2 87.4 M AL 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 6 92.2 M Graduate 7 91.4 M Graduate 8 85.1 F Graduate 9 90.0 M AL 10 86.4 F AL 11 81.2 F OL 12 91.5 M Graduate 13 88.6 M OL > cd1<-read.table("H:/children.txt",header=T) > cd1[ ,1] [1] 90.2 87.4 83.8 85.1 82.2 92.2 91.4 85.1 90.0 86.4 81.2 91.5 88.6 > cd1$height [1] 90.2 87.4 83.8 85.1 82.2 92.2 91.4 85.1 90.0 86.4 81.2 91.5 88.6 > attach(cd1) > mean(height) [1] 87.31538 > mean(cd1$height) [1] 87.31538 > sd(cd1$height) [1] 3.672158 > sd(height) [1] 3.672158 > attach(height) Error in attach(height) : 'attach' only works for lists, data frames and environments > summary(height) Min. 1st Qu. Median Mean 3rd Qu. Max. 81.20 85.10 87.40 87.32 90.20 92.20 > summary(gender) F M 6 7 > summary(edu) AL Graduate OL 5 4 4 > split(cd1) Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : argument "f" is missing, with no default > attach(cd1) The following objects are masked from cd1 (pos = 3): edu, gender, height > split(cd1,gender) $F height gender edu 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 8 85.1 F Graduate 10 86.4 F AL 11 81.2 F OL $M height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL > split(cd1,edu) $AL height gender edu 1 90.2 M AL 2 87.4 M AL 4 85.1 F AL 9 90.0 M AL 10 86.4 F AL $Graduate height gender edu 6 92.2 M Graduate 7 91.4 M Graduate 8 85.1 F Graduate 12 91.5 M Graduate $OL height gender edu 3 83.8 F OL 5 82.2 F OL 11 81.2 F OL 13 88.6 M OL > > cd2$F Error: object 'cd2' not found > cd1$F NULL > cd3<-split(cd1,gender) > cd3$F height gender edu 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 8 85.1 F Graduate 10 86.4 F AL 11 81.2 F OL > mean((cd3$"M")$height) [1] 90.18571 > Male<-cd3$"M" > Male height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL > Feale<-cd3$"M" > Female Error: object 'Female' not found > Feale<-cd3$"F" > Female Error: object 'Female' not found > Female<-cd3$"F" > Female height gender edu 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 8 85.1 F Graduate 10 86.4 F AL 11 81.2 F OL > mean(Male$height) [1] 90.18571 > mean(Feale$height) [1] 83.96667 > summary(Female[1]) height Min. :81.20 1st Qu.:82.60 Median :84.45 Mean :83.97 3rd Qu.:85.10 Max. :86.40 > summary(Female[2] + + > summary(Female[2]) gender F:6 M:0 > summary(Female) height gender edu Min. :81.20 F:6 AL :2 1st Qu.:82.60 M:0 Graduate:1 Median :84.45 OL :3 Mean :83.97 3rd Qu.:85.10 Max. :86.40 > summary(Male) height gender edu Min. :87.40 F:0 AL :3 1st Qu.:89.30 M:7 Graduate:3 Median :90.20 OL :1 Mean :90.19 3rd Qu.:91.45 Max. :92.20 > summary(Male[1:2]) height gender Min. :87.40 F:0 1st Qu.:89.30 M:7 Median :90.20 Mean :90.19 3rd Qu.:91.45 Max. :92.20 > cd3$"M" height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL > cd3$M height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL > summary(Male$height) Min. 1st Qu. Median Mean 3rd Qu. Max. 87.40 89.30 90.20 90.19 91.45 92.20 > summary(Male[1]) height Min. :87.40 1st Qu.:89.30 Median :90.20 Mean :90.19 3rd Qu.:91.45 Max. :92.20 > summary(Male$height:$weight) Error: unexpected '$' in "summary(Male$height:$" > summary(Male$height:$gender) Error: unexpected '$' in "summary(Male$height:$" > summary(height) Min. 1st Qu. Median Mean 3rd Qu. Max. 81.20 85.10 87.40 87.32 90.20 92.20 > summary(Male[[1]]) Min. 1st Qu. Median Mean 3rd Qu. Max. 87.40 89.30 90.20 90.19 91.45 92.20 > summary(Male[1]) height Min. :87.40 1st Qu.:89.30 Median :90.20 Mean :90.19 3rd Qu.:91.45 Max. :92.20 > summary(Male[[1:2]]) Min. 1st Qu. Median Mean 3rd Qu. Max. 87.4 87.4 87.4 87.4 87.4 87.4 > summary(Male[ ,1]) Min. 1st Qu. Median Mean 3rd Qu. Max. 87.40 89.30 90.20 90.19 91.45 92.20 > summary(height[gender=1]) Min. 1st Qu. Median Mean 3rd Qu. Max. 90.2 90.2 90.2 90.2 90.2 90.2 > summary(height[gender=2]) Min. 1st Qu. Median Mean 3rd Qu. Max. 87.4 87.4 87.4 87.4 87.4 87.4 > male Error: object 'male' not found > Male height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL > Female height gender edu 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 8 85.1 F Graduate 10 86.4 F AL 11 81.2 F OL > rbind(Male,Female) height gender edu 1 90.2 M AL 2 87.4 M AL 6 92.2 M Graduate 7 91.4 M Graduate 9 90.0 M AL 12 91.5 M Graduate 13 88.6 M OL 3 83.8 F OL 4 85.1 F AL 5 82.2 F OL 8 85.1 F Graduate 10 86.4 F AL 11 81.2 F OL > cbindMale,Female) Error: unexpected ',' in "cbindMale," > cbind(Male,Female) Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 7, 6 > rc1<-rbind(Male,Female) > tapply(height,edu,mean) AL Graduate OL 87.82 90.05 83.95 > tapply(height,edu,max) AL Graduate OL 90.2 92.2 88.6 > table1<-table(gender) > table1 gender F M 6 7 > table(gender) gender F M 6 7 > names(table1) [1] "F" "M" > names(table1)<-c('Female","Male") + names(table1) + > table2<-table(gender,edu) > table2 edu gender AL Graduate OL F 2 1 3 M 3 3 1 > names(table1)<-c("Female","Male") > names(table1) [1] "Female" "Male" > table2<-table(gender,edu) > table2 edu gender AL Graduate OL F 2 1 3 M 3 3 1