RvS
RvS

Reputation: 1

How do I make summarize(count_by_) in dplyr only count instances if there is an exact match?

I am trying to make a pivot table of a large .tsv data set in R and exporting it back to Excel.

I tried using the dplyer functions:

summary <- df %>%
group_by(Run,Prot) %>%
summarize(count_by_Id = n()) %>%
as.data.frame()

This almost works, but rows with e.g. "P61981;P62258" and "P62258" in the Prot column are counted together. How do I make R only summarize rows that have exactly the same strings in the Prot columns. So that in case of the above example there will be two different rows (for "P61981;P62258" and "P62258") in the summary data I am creating.

Upvotes: 0

Views: 71

Answers (0)

Related Questions