1
votes
 gene   HSC_7256.bam HSC_6792.bam HSC_7653.bam   HSC_5852

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

I doing something like this

HSC<- EPIGENETIC_FACTOR_SEQMONK %>%
    select(EPIGENETIC_FACTOR_SEQMONK,gene)

I get this error

Error: EPIGENETIC_FACTOR_SEQMONK must resolve to integer column positions, not a list

So i have to do this take out all the HSC sample average them

Anyone suggest what am i doing it incorrectly ?that would be helpful

1
Is EPIGENETIC_FACTOR_SEQMONK the name of a column in your data frame? If not, you cannot select it.George Wood
no thats the name of my data frame...kcm

1 Answers

2
votes

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)

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.