telo.control <- c(0.95, 0.96, 1.07, 1.08, 1.09,
1.1, 1.12, 1.14, 1.18, 1.19,
1.19, 1.2, 1.34, 1.45, 1.49,
1.55)
telo.disturbed <- c(0.83, 0.84, 0.87, 0.93, 0.94,
0.96, 0.99, 1.00, 1.01, 1.01,
1.02, 1.05, 1.07, 1.08, 1.09,
1.09, 1.12, 1.13, 1.16, 1.24,
1.41)
cort.control <-c(6.32, 1.56, 8.61, 4.86, 3.32,
4.31, 1.84, 10.45, 1.47, 4.57,
1.95, 5.93, 8.89, 1.16, NA,
NA)
cort.disturbed <- c(7.38, 5.39, 5.39, 5.73, 18.35,
0.95, 1.72, 7.26, 1.38, 4.22,
7.52, 12.52, 3.86, 3.12, 1.36,
2.26, 0.85, 4.76, 0.95, 6.92,
2.16)
sex.cntrl <- c("F","M","F","F","F","F","F","M","F","F","M","F","M","M",
"F","F")
sex.dist <- c("M", "M", "F", "F", "F", "M", "F", "M", "F", "M", "F",
"F", "M", "F", "M", "M", "F", "M", "F", "M", "M")
is.vector(telo.control)
## [1] TRUE
#length
length(telo.control)
## [1] 16
Acts exactly like a word processor
mean(telo.disturbed)
## [1] 1.04
median(telo.disturbed)
## [1] 1.02
max(telo.disturbed)
## [1] 1.41
min(telo.disturbed)
## [1] 0.83
summary(telo.disturbed)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0.83 0.96 1.02 1.04 1.09 1.41
hist(telo.control)
boxplot(telo.control)
telomeres <- c(telo.control, telo.disturbed)
length(telomeres <- c(telo.control, telo.disturbed))
## [1] 37
is.vector(telomeres)
## [1] TRUE
is.data.frame(telomeres)
## [1] FALSE
ls()
## [1] "cort.control" "cort.disturbed" "sex.cntrl" "sex.dist"
## [5] "telo.control" "telo.disturbed" "telomeres"
sex.cntrl
## [1] "F" "M" "F" "F" "F" "F" "F" "M" "F" "F" "M" "F" "M" "M" "F" "F"
sex.dist
## [1] "M" "M" "F" "F" "F" "M" "F" "M" "F" "M" "F" "F" "M" "F" "M" "M" "F" "M" "F"
## [20] "M" "M"
is(sex.cntrl)
## [1] "character" "vector" "data.frameRowLabels"
## [4] "SuperClassMethod"
is(sex.dist)
## [1] "character" "vector" "data.frameRowLabels"
## [4] "SuperClassMethod"
sex <- c(sex.cntrl, sex.dist)
sex
## [1] "F" "M" "F" "F" "F" "F" "F" "M" "F" "F" "M" "F" "M" "M" "F" "F" "M" "M" "F"
## [20] "F" "F" "M" "F" "M" "F" "M" "F" "F" "M" "F" "M" "M" "F" "M" "F" "M" "M"
length(sex)
## [1] 37
length(telomeres)==length(sex)
## [1] TRUE
data.frame(telomeres, sex)
## telomeres sex
## 1 0.95 F
## 2 0.96 M
## 3 1.07 F
## 4 1.08 F
## 5 1.09 F
## 6 1.10 F
## 7 1.12 F
## 8 1.14 M
## 9 1.18 F
## 10 1.19 F
## 11 1.19 M
## 12 1.20 F
## 13 1.34 M
## 14 1.45 M
## 15 1.49 F
## 16 1.55 F
## 17 0.83 M
## 18 0.84 M
## 19 0.87 F
## 20 0.93 F
## 21 0.94 F
## 22 0.96 M
## 23 0.99 F
## 24 1.00 M
## 25 1.01 F
## 26 1.01 M
## 27 1.02 F
## 28 1.05 F
## 29 1.07 M
## 30 1.08 F
## 31 1.09 M
## 32 1.09 M
## 33 1.12 F
## 34 1.13 M
## 35 1.16 F
## 36 1.24 M
## 37 1.41 M
df <- data.frame(telomeres, sex)
dim(df)
## [1] 37 2
nrow(df)
## [1] 37
ncol(df)
## [1] 2
This allowes you to see top and bottom chunk of data
head(df)
## telomeres sex
## 1 0.95 F
## 2 0.96 M
## 3 1.07 F
## 4 1.08 F
## 5 1.09 F
## 6 1.10 F
tail(df)
## telomeres sex
## 32 1.09 M
## 33 1.12 F
## 34 1.13 M
## 35 1.16 F
## 36 1.24 M
## 37 1.41 M
boxplot(telomeres ~ sex, data = df)
# 50% of the data lies within the box
length(telo.control)
## [1] 16
trt.C <- rep("C", 16)
trt.D <- rep("D", 21)
trt.C
## [1] "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C" "C"
trt.D
## [1] "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D" "D"
## [20] "D" "D"