Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
58 lines (34 sloc) 962 Bytes
#1 HELP
help(mean)
?mean
example(mean)
#2 CREATE A VECTOR
rwb <- c(32, 51, 33, 35, 20, 28, 14, 36, 29, 41, 33, 30, 30, 31, 34, 31, 36, 17, 27, 35, 28, 32, 27, 37, 20, 27, 26, 46, 42, 45, 31, 29, 21, 17, 30, 33, 49, 32, 21, 24, 21, 36, 24, 27, 38, 27, 45, 20, 27, 28, 38, 42, 27, 29, 47, 17, 38, 17, 41, 43, 45, 48, 29, 58, 23, 33, 25, 24, 28, 15, 18, 39, 37, 57, 32, 40, 12, 45, 23, 50)
#3 MEAN / MEDIAN
mean(rwb)
median(rwb)
#4 APPEND A VECTOR
rwb <- c(rwb, 5)
#5 SMART FILTERING
rwb[1]
rwb[1:5]
rwb[rwb>39]
#6 SIMPLE GRAPH PLOT
plot(1:81,rwb)
lines(1:81,rwb)
#7 SIMPLE HISTOGRAM
hist(rwb)
#8 RANDOM NUMBERS
rnorm(5)
rnorm(5) * 100
abs(rnorm(5) * 100)
#9 IMPORT DATA
hp <- scan("c:\\data\\hp1words.txt", character(), "\n")
#10 GROUP DATA
hpWordGroups <- table(hp)
#11 SORT DATA
sort(hpWordGroups)
#12 USE A CUSTOM SCRIPT
source("c:\\Users\\You\\Downloads\\top10.R")
books10 <- top10("c:\\data\\books.txt")
top10plot(c:\\data\\books.txt")
You can’t perform that action at this time.