my dataframe looks like this.
df <- read.table(text="
column1 column2 column3
1 3 2 1
1 3 2 1
", header=TRUE)
I need to subtract last 2 columns from first. For counting that columns I´d use rowSums(summary[,1:3])
but I don´t know how to subtract this columns. Note that I can´t just write my code like this since I don´t know column names.
`result <- df %>%
mutate(result = rowSums(column1, - column2, - column3))`