5.9 R 데이터 관리 함수
c(…) seq(from,to) seq(along=x) rep(x,times) rep(c(1,2,3),each=2)
all.equal identical
data.frame(…) list(…) array(x,dim=) matrix(x,nrow=,ncol=) factor(x,levels=) gl(n,k,length=n*k,labels=1:n) expand.grid() rbind(…) cbind(…)
Data selection and manipulation which.max(x) which.min(x) rev(x) sort(x) rev(sort(x)) cut(x,breaks) match(x, y) which(x == a) choose(n, k) na.omit(x) na.fail(x) unique(x) table(x) subset(x, …) sample(x, size) prop.table(x,margin=)
by(data,INDEX,FUN) merge(a,b) xtabs(a b,data=x) aggregate(x,by,FUN) stack(x, …) unstack(x, …) reshape(x, …)