0

I have a table with columns like CPA_A to CPA_U. I want to create a new column X as the sum of CPA_A to CPA_U in DPLYR. I tried something like

 mutate(sum_onCPA = rowSums(.SD), .SDcols = grep("CPA", names(M_bridge)))

but it does not work. Any clue?

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
IRT
  • 209
  • 2
  • 11

0 Answers0