I'm very new to R and currently struggling to calculate sums per row. Since there are some other columns with meta data I have to select specific columns (i.e. column 2 to 43) for the sum.
I tried this but it only gives "0" as sum for each row without any further error:
SUM_df <- dplyr::mutate(df, "SUM_RQ" = rowSums(dplyr::select(df[,2:43]), na.rm = TRUE))
This code works but then I loose all meta data in the other columns which I want to keep
SUM_df <- df %>%
mutate("SUMRQ" = rowSums(., na.rm = TRUE))
Is there any option to rewrite the first code and select the columns "inside" rowSums?
I'm sorry for this very basic question but I just can't find the error...