I would like to merge and sum the values of each row that contains duplicated IDs.
For example, the data frame below contains a duplicated symbol \'LOC102723897\'. I wou
You group-by on Symbol and sum all columns.
Symbol
sum all
library(dplyr) df %>% group_by(Symbol) %>% summarise_all(sum)
using data.table
data.table
library(data.table) setDT(df)[ , lapply(.SD, sum),by="Symbol"]
We can just use aggregate from base R
aggregate
base R
aggregate(.~ Symbol, df, FUN = sum)