################################# # Zuweisen, Abfragen, Berechnen # ################################# ######################## # R als Taschenrechner # ######################## 1+2 4+6 3.5+2.4 6*3+4+2*4 4+1/(1+3^2) 2+pi ############ # Vektoren # ############ x<-5 x x<-c(1,2,3,4,5) x y<-x+1 y z<-y*2 z f<-c(y,z) f+x x[3] x[1:5] ####################### # logische Ausdruecke # ####################### 1==1 1==3 3.14 > pi x==y f==c(y,y) ############## # Funktionen # ############## x<-c(1,4,3,6,5,2,7,5,3,5) sum(x) mean(x) sort(x) rank(x) which(x == 2) round(sqrt(x)) ?round ########## # Pakete # ########## library(MASS) ############### # Datensaetze # ############### Animals head(Animals) Animals[,1] Animals[2,] brain attach(Animals) sum(Animals[,2]) sum(brain) sum(brain[1:5]) ################ # Verteilungen # ################ ?dbinom dbinom(3,10,0.7) dbinom(0:3,10,0.7) sum(dbinom(0:3,10,0.7)) pbinom(3,10,0.7) ?dhyper ?dpois