[英]How to normalize data in R excluding certain rows?
I am trying to graph some sequencing data and want to exclude Chromosome 4 data (where the rows in the first column have a '4') when I scale it. 我正在尝试绘制一些测序数据,并希望在缩放时排除第4号染色体数据(第一列中的行具有“ 4”)。 Chromosome 4 may skew the normalizing, so I want to exclude it from my scale() function. 染色体4可能会使正常化倾斜,因此我想将其从我的scale()函数中排除。 Is there any way to do that? 有什么办法吗? Right now, I have: 现在,我有:
preMBT_RT <-preMBT_RT %>% mutate_each_(funs(scale(.) %>% as.vector),vars=c("Timing"))
^But is there any way I can indicate IN that function to exclude rows with '4' in the first column?? ^但是我有什么办法可以指示该函数排除第一列中带有“ 4”的行? Or is the only way to do that to create a NEW data frame which does not have chromosome 4 data in it? 还是唯一的方式来创建一个其中没有第4号染色体数据的新数据框?
Here is a sample of what the data frame looks like in brief: 这是数据框的简要示例:
Chromosome Location Replication Timing
1 3748 -0.0001
4 1847101 0.000302 <-row I would want to exclude
20 1234 0.000102
... ... ...
You can always use the filter()
method, like: 您可以始终使用filter()
方法,例如:
preMBT_RT <-preMBT_RT %>% filter(Chromosome!=4) %>%
mutate_each_(funs(scale(.) %>% as.vector),vars=c("Timing"))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.