正态分位数变换

时间:2018-03-23 20:26:18

标签: r quantile

我需要在R

中进行分位数归一化

输入文件只是我有超过5000个值的小子集:

x <- data.frame(A =c(193973, 185750, 185511,NA), B= c(56433,52298, 53040, NA), C = c(4668, 6074,6246, NA))
我正在使用的软件推荐

xtransformed = qqnorm(x, plot.it =F)$x

我不明白&#34; $ x&#34;到底在这?

其他问题是:

如果是输入(这是我的实际输入

x <- data.frame(A =c("A","B","C","D"), B = c("X", "Y", "Z","L"), C=c(193973, 185750, 185511, "NA"), D = c(56433,52298, 53040, "NA"), E = c(4668, 6074,6246, "NA"))

我只选择要转换的列

y =x[,3:5]

使用该代码转换它并且它不起作用?是什么原因

ytransformed <- qqnorm(y, plot.it =F)$y

ytransformed 

我做到了。现在我想绘制并查看它是否已经转变?我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

Bioconductor中的preprocessCore包具有此功能。首次安装&amp;加载它:

source('http://bioconductor.org/biocLite.R')
biocLite('preprocessCore')
library(preprocessCore)

然后从数据框中创建一个矩阵,并normalize.quantiles

> x <- data.frame(A =c(193973, 185750, 185511,NA), B= c(56433,52298, 53040, NA), C = c(4668, 6074,6246, NA))
> m <- data.matrix(x,rownames.force=nrow(x))
> normalize.quantiles(m)
         [,1]     [,2]     [,3]
[1,] 85550.67 85550.67 80825.67
[2,] 82143.61 80825.67 82143.61
[3,] 80825.67 82143.61 85550.67
[4,]       NA       NA       NA