This is a test version of Biostars. For the public version, visit https://www.biostars.org.
R package plyr:count output int not num

I have a dataframe data3_back, and I want to sum value which have same "bp".

enter image description here

So I use this

> data3_back1<-count(data3_back,"bp")

But the output "freq" is int rather than numeric.

enter image description here

Is there anyway to handle it? Or is there any other way to achieve my purpose?

r

Please do not post the images of the data. try as.numeric

Thank you for your reply. I make a silly mistake and I misunderstand the function of "count".

1 answer

This will sum the values of the value column for rows that have the same bp:

 data3_back1 %>%
     group_by(bp) %>%
     summarise(tot_sum = sum(value))

However, your example with count seems to indicate you want to do something else - could you clarify the question?

Log in to answer this question.