how arrange samples columns according to row names from another file in R
1
0
Entering edit mode
10 months ago
Bioinfonext ▴ 470

Hi all,

Could you please let me know how we can arrange mval columns in same order as targets2 row names.

#phenotype file
targets<-read.table("limma.phenos.hba1c.304.txt", header=TRUE, stringsAsFactor=FALSE,row.names=NULL, sep="\t")



head(targets2)
                  BeadChipID sex age creat_umol_per_L    creat      eGFR Batch
DC464   202995740113_R06C01   1  30               85 0.961520 108.84266     8
DDN89   200788250048_R07C01   1  51               80 0.904960 102.72419     6
DC223   200788250033_R04C01   0  41               59 0.667408 112.64654     6
dim(targets2)
[1] 304  21
#read mehtylation data

###################





mval <- read.table("beta.new.304.csv",sep=",", as.is=T, na.strings="NA", check.names=FALSE, header =T)





 head(mval, 10) [,1:5]
                  DN54      DC146      DDN44      DC179      DN121
    cg26928153  2.4791678  2.8599419  2.7693438  3.1229033  2.9644520
    cg16269199  1.4452663  1.4528645  1.6557921  1.7818135  1.9590533
    cg13869341  2.4145157  2.6571868  2.1751019  3.1139991  3.4626554
statistics r biostatistics • 367 views
ADD COMMENT
1
Entering edit mode
10 months ago

This isn't really a bioinformatics question, but you can do:

mval <- mval[, rownames(targets2)]
ADD COMMENT

Login before adding your answer.

Traffic: 2659 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6