我正在尝试对数据进行分位数归一化。我试图将输出写入表,但它只给我一列。谁能提出解决方案
test.txt
ID IID G9 G3 G3A G30 G32 G33 G34 G35
1509 5 0 0 0 0 0 88 88 88
1506 11 0 0 0 0 0 88 88 88
339 26 7 0 0 58 0 11 0 .
1104 33 0 41 0 0 0 88 88 88
1407 68 0 35 0 0 0 11 0 28
442 75 1 45 35 49 0 88 88 88
1509 80 0 0 0 0 0 16 0 30
527 86 0 0 0 0 0 88 88 88
170 89 2 0 0 0 0 88 88 88
代码:
x <- read.table("test.txt",header=T)
x <- data.matrix(x[,3:10])
hist(x, main="Selected dataset")
x_transformed <- qqnorm(x, plot.it =F)$x
hist(x_transformed, breaks=10, main="Selected transformed datset")
write.table(x_transformed, file="transformedile.txt", sep="\t" , quote=F, row.names=F)
结果:
x
-2.46012433756
-2.03683413170139
0.528399301498654
-1.81551733495267
-1.65847206103563
0.122153088902552
-1.53412054435255
-1.42978833594552
0.192663868219727