On 2020-05-06 09:13 +0000, PIKAL Petr wrote: > Maybe aggregate? Hi! I agree aggregate is an elegant solution for this, so I continued your example a bit:
dt_count <- '"","STATUS","N"
"1","Resolved",650
"2","Assigned",135
"3","Closed",530
"4","In Progress",56
"5","Pending",75
"6","Cancelled",20'
dt_count <- read.csv(text=dt_count)
dt_count[
dt_count$STATUS %in%
c("Resolved", "Closed"),
"STATUS"] <-
"Resolved/Closed"
aggregate(
x=list("N"=dt_count$N),
by=list("STATUS"=dt_count$STATUS),
FUN=sum)
Best,
Rasmus
signature.asc
Description: PGP signature
______________________________________________ [email protected] mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

