R 列表随意组合 data.frame(x,y)

> protein_data_B30_min<-protein_data[1:2548,10:12] > protein_data_M30_min<-protein_data[1:2548,19:21] > protein_data_30_min<-data.frame(protein_data_B30_min,protein_data_M30_min) > protein_data_30_min[1:2,] B30 B30.1 B30.2 Mgo30 Mgo30.1 Mgo30.2 1 870.5042 867.0873 0 1086.82[......]

Read more

[…]

R画 维恩图

 

> install.packages('plotrix') Installing package(s) into ‘/home/shenzy/R/x86_64-pc-linux-gnu-library/2.15’ (as ‘lib’ is unspecified) 试开URL’http://cran.csiro.au/src/contrib/plotrix_3.4-5.tar.gz' Content type 'application/x-gzip' length 211113 bytes (206 Kb) 打开了URL ==================[......]

Read more

[…]

Using prcomp/princomp for PCA in R (三)

Testing i.pca ~ prcomp(), m.eigensystem ~ princomp()

1. Briefly about PCA 2. The modules/functions that implement PCA in GRASS & R 3. My claims (Entitled Comments) 4. Evidence (=the numbers derived from i.pca, prcomp, princomp, m.eigensystem using some MODIS surface reflectance bands).[……]

Read more

[…]

Using prcomp/princomp for PCA in R (二)

############################### PCA ############################### install.packages(“vegan”) library(vegan) > STpcoa<-read.table(file=”bactera_16s_final.subsample.phylip.tre1.weighted.phylip.pcoa.axes”, header=T,row.names=1) > STpcoa axis1 axis2 axis3 axis4 Cellulose -0.020878[……]

Read more

[…]

Using prcomp/princomp for PCA in R (一)

Difference between prcomp and princomp: ‘princomp’ can only be used with more units than variables” prcomp是基于SVD分解(svd()函数,princomp是基于特征向量eigen()函数) Good video source: http://www.youtube.com/watch?v=oZ2nfIPdvjY http://www.youtube.com/watch?v=I5GxNzKLIoU&feature=relmfu http://ww[……]

Read more

[…]

4sample CA RDA analysis

  > gtsdata_test=read.table(“gtsdata.txt”, header=T) > gtsenv=read.table(“gtsenv.txt”, header=T) > gtsdata_data_t<-t(gtsdata_data) > decorana(gtsdata_data_t) Call: decorana(veg = gtsdata_data_t) Detrended correspondence analysis with 26 segments. Rescaling of axes w[……]

Read more

[…]

R 中字符矩阵转化为数值矩阵

a.str <- matrix(c(‘1′,’2′,’3′,’5′,NA,’6′) + ,c(2,3),dimnames = list(c(‘g1′,’g2′),c(‘t1′,’t2′,’t3′))) a.str # t1 t2 t3 # g1 “1” “3” NA # g2 “2” “5” “6” a.num <- apply(a.str, c(1,2), as.numeric) a.num # t1 t2 t3 # g1 1 3 NA # g2 2 5 6 Note: 第一行,第一列位置要为空!! […]

基于Vegan 软件包的生态学数据排序分析学习

“基于Vegan 软件包的生态学数据排序分析 赖江山 米湘成 (中国科学院植物研究所植被与环境变化国家重点实验室,北京 100093) 摘要:群落学数据一般是多维数据,例如物种属性或环境因子的属性。多元统计分析是群落生态学常用的分析方法,排序(ordination)是多元统计最常用的方法之一。CANOCO是广泛使用的排序软件,但缺点是商业软件价格不菲,版本更新速度也很慢。近年来,R语言以其灵活、开放、易于掌握、免费等诸多优点,在生态学和生物多样性研究领域迅速赢得广大研究人员的青睐。R语言中的外在软件包“Vegan”是专门用于群落生态学分析的工具。Vegan能够提供所有基本的排序方法,同时[……]

Read more

[…]

R OTU heatmap2

source(“http://www.bioconductor.org/biocLite.R”); biocLite(“affy”); biocLite(“Biobase”); library(affy); library(Biobase); >bac_4sampledata=read.csv(“/home/R_heatmap/4sample_R_cluster.csv”, sep=”\t”) > row.names(bac_4sampledata)<-bac_4sampledata$Group > bac_4sample_Datamatrix<[……]

Read more

[…]

Change heatmap.2 defaults dist for calculating the distance matrix and hclust for clustering

Glancing at the code for heatmap.2 I’m fairly sure that the default is to use dist, and it’s default is in turn to use euclidean distances. The reason your attempt at passing distfun = dist(method = 'euclidean') didn’t work is thatdistfun (and hclustfun) are supposed to simply be name of function[……]

Read more

[…]