且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

基于一列的标准化R函数?

更新时间:2023-01-31 12:36:45

使用你的数据,你先写一个 min max 函数:

Using your data, you write a min max function first:

minmax = function(x){ (x-min(x))/(max(x)-min(x))}

然后遍历列:

norm = data.frame(lapply(dat1[,1:3],function(i) minmax(i/dat1$samples)))

它看起来像这样,我希望它是正确的:

And it looks like this, I hope it's correct:

       gene1     gene2      gene3
1 0.03385417 0.2458333 1.00000000
2 0.61970339 1.0000000 0.01326455
3 0.00000000 0.0000000 0.09565217
4 1.00000000 0.2269231 0.00000000