- R Reference Card はRの基本事項をカテゴリ別に並べたもの(こちら)
- 基本的な関数の一覧を素早く探したいときに有用
- ヘルプ関係
help(dist)
help(stats)
help(package="stats")
library(help="stats")
?dist
??dist
apropos("lm")
help(plot.lm)
c(3,5,2.3,1.4*exp(10))
2.6:20
seq(from=2.3,to=20,by=0.3)
rep(c(1,2,3,4),2)
rep(c(1,2,3,4),each=2)
x<-1:10
data.frame(x,sin(x),cos(x),x^2)
list(a=x,b=paste("id=",x,sep=""),あ=matrix(0,3,4),data.frame(data.frame(x,sin(x),cos(x),x^2)),fctr=factor(x),arr=array(x,c(2,3,2)))
x<-1:10
x[3]
x[-3]
x[-5][-3]
x[-c(3,5,6:8)]
x[-3:0]
x[x>3 & x<7]
x[x>7 | x<3]
x[x %in% c(x^2)]
library(lattice)
x<-runif(10)
x
rev(x)
sort(x)
cut(x,3)
cut(x,c(0,0.2,0.7,1))
x<-c(x,NA,NaN)
na.omit(x)
na.fail(x)
x<-rpois(10,5)
x
unique(x)
which(x==x[1])
table(x)
x<-matrix(runif(20),4,5)
x
subset(x,x[,1]<0.2)
prop.table(x)
x/sum(x)
library(lattice)
n<-100
x<-seq(from=0,to=1,length.out=n)
y<-seq(from=0,to=1,length.out=n)
xy<-expand.grid(x,y)
z1<-cos(xy[,1])^2*sin(xy[,2])
z2<-cos(xy[,1])-sin(xy[,2])
xx<-rep(xy[,1],2)
yy<-rep(xy[,2],2)
zz<-c(z1,z2)
gr<-c(rep(1,length(xy[,1])),rep(2,length(xy[,1])))
wireframe(zz ~ xx * yy, groups = gr)
cloud(zz ~ xx * yy, groups = gr,screen = list(x = -90, y = 20))