dplyr中多列的平均值得到错误“必须解析为整数列位置,而不是列表”。 [英] Average of Multiple columns in dplyr getting error "must resolve to integer column positions, not a list"
问题描述
gene HSC_7256.bam HSC_6792.bam HSC_7653.bam HSC_5852
我的数据框看起来像这样,我可以用正常的方式做到这一点,例如取出列使另一个数据帧平均化,但是我想在dplyr中做到这一点,我很难过,我不确定是什么问题
My data frame looks like this i can do that in a normal way such as take out the columns make another data frame average it ,but i want to do that in dplyr and im having a hard time I not sure what is the problem
我正在做类似的事情
HSC<- EPIGENETIC_FACTOR_SEQMONK %>%
select(EPIGENETIC_FACTOR_SEQMONK,gene)
我收到此错误
错误:
EPIGENETIC_FACTOR_SEQMONK
必须解析为整数列位置,而不是列表
Error:
EPIGENETIC_FACTOR_SEQMONK
must resolve to integer column positions, not a list
所以我必须这样做,取出所有HSC样本的平均值
So i have to do this take out all the HSC sample average them
有人建议我是什么
推荐答案
%>%
函数将其左侧的所有内容拉到跟随功能。如果您的数据框是 EPIGENETIC_FACTOR_SEQMONK
,则这两个语句是等效的:
The %>%
function pulls whatever is to the left of it into the first position of the following function. If your data frame is EPIGENETIC_FACTOR_SEQMONK
, then these two statements are equivalent:
HSC <- EPIGENETIC_FACTOR_SEQMONK %>%
select(gene)
HSC <- select(EPIGENETIC_FACTOR_SEQMONK, gene)
首先,我们将 EPIGENETIC_FACTOR_SEQMONK
传递到 select
使用%>%
,通常在 dplyr
链中用作 dplyr
函数是一个数据框。
In the first, we are passing EPIGENETIC_FACTOR_SEQMONK
into select
using %>%
, which is generally used in dplyr
chains as the first argument in dplyr
functions is a data frame.
这篇关于dplyr中多列的平均值得到错误“必须解析为整数列位置,而不是列表”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!