USpoints<-c(2413, 20310, 12637, 2753, 14505, 14440, 2379, 447, 345, 4784, 13803, 12668, 1235, 1257, 1671, 4041, 4145,
535, 5270, 3360, 3489, 1979, 2302, 807, 1772, 12807, 5427, 13147, 6288, 1803, 13167, 5343, 6684, 3508, 1549,
4975, 11249, 3213, 811, 3560, 7244, 6643, 8571, 13534, 4395, 5729, 14417, 4863, 1951, 13809)
#Answers to 1.a.
max(USpoints)
## [1] 20310
min(USpoints)
## [1] 345
#Answer to 1.c.
sort(USpoints, decreasing=FALSE)
## [1] 345 447 535 807 811 1235 1257 1549 1671 1772 1803 1951
## [13] 1979 2302 2379 2413 2753 3213 3360 3489 3508 3560 4041 4145
## [25] 4395 4784 4863 4975 5270 5343 5427 5729 6288 6643 6684 7244
## [37] 8571 11249 12637 12668 12807 13147 13167 13534 13803 13809 14417 14440
## [49] 14505 20310
USpoints=sort(USpoints, decreasing=FALSE)
which(USpoints==3489)
## [1] 20
#Answer to 2.a.
x=seq(from=5, to=-11, by=-0.3)
#Answer to 2.b.
sort(x, decreasing=FALSE)
## [1] -10.9 -10.6 -10.3 -10.0 -9.7 -9.4 -9.1 -8.8 -8.5 -8.2 -7.9 -7.6
## [13] -7.3 -7.0 -6.7 -6.4 -6.1 -5.8 -5.5 -5.2 -4.9 -4.6 -4.3 -4.0
## [25] -3.7 -3.4 -3.1 -2.8 -2.5 -2.2 -1.9 -1.6 -1.3 -1.0 -0.7 -0.4
## [37] -0.1 0.2 0.5 0.8 1.1 1.4 1.7 2.0 2.3 2.6 2.9 3.2
## [49] 3.5 3.8 4.1 4.4 4.7 5.0
#Answer to 2.c.
x=sort(x, decreasing=FALSE)
median(x)
## [1] -2.95
min(x)
## [1] -10.9
max(x)
## [1] 5
length(x)
## [1] 54
x[27]
## [1] -3.1
x=c(-10.9,-3.1,5)
x
## [1] -10.9 -3.1 5.0
#Answer to 3.a.
x<-c(rep(c(5.3),times=3,each=1),rep(c(1.2,3.4,5.6),times=2,each=1), seq(from=6,to=12), -3)
#Answer to 3.b.
length(x)
## [1] 17
#Answer to 4
GreysAnatomy<-data.frame(person=c("Meredith","Christina","Derek","Jackson","Catherine","Arizona","Callie","Owen","Amelia","Miranda"),
specialty=factor(c("General Surgery","Cardiothoracic Surgery","Neurosurgery","Plastic Surgery","Urology","Pediatric Surgeon","Orthopedic Surgery","Trauma Surgery","Neurosurgery","General Surgery")),sex=factor(c("F","F","M","M","F","F","F","M","F","F")))