R学习1——基本语法

来源:互联网 发布:12123app网络请求失败 编辑:程序博客网 时间:2024/06/01 09:31


赋值(向量)  c <- c(1,2,3,4,5) assign("x",c(1,2,3,4,5))  c(1,2,3,4,5) ->x


运算 +,-,*,/,mean,log,exp,sin,cos,tan,sqr,max,min,sum,prod,length,var,sort,order,sort.list,seq(-5,5,0.2),

rep(a,5),NA,paste(任意多的参数), (x+1)[(!is.na(x)) & x>0] -> z, c("x","y")[rep(c(1,2,2,1), times=4)]

"X""Y""Y""X"16个,names(名字索引),x[is.na(x)] <- 0


其他matrix,array, Z <- array(0,c(3,4,2)),factory,dim,aperm,outer,nrow,ncol,eigen,svd,lsfit,ls.diag,cbind,

rbind,cut,attach,search,detach,read.table,scan,data,edit,


控制循环if else,for,while


优先级 :最高


概率分布

β分布beta shape1, shape2, ncp

二项式分布binom size, prob

Cauchy 分布 cauchylocation, scale

卡方分布chisq df, ncp

指数分布exp rate

F分布f df1, df1, ncp

γ分布gamma shape, scale

几何分布geom prob

超几何分布hyper m, n, k

对数正态分布lnorm meanlog, sdlog

logistic 分布 logislocation, scale

负二项式分布nbinom size, prob

正态分布norm mean, sd

Poisson 分布 pois lambda

t 分布t df, ncp

均匀分布unif min, max

Weibull 分布 weibull shape, scale

Wilcoxon 分布 wilcox m, n


0 0