I'm trying to combine several columns with the mutate (dplyr) function. It works quite well with the + and the individual names of the columns. But I need some command to mutate all columns from column "a" TO column "c" without having to write down each column by name and without the column d.
Also there are some NA in it and i want to "ignor" them but all i get is a new column that said "TRUE" Can someone help me?
Example
a<-c(1,2,3,4,5)
b<-c(6,7,NA,9,10)
c<-c(11,12,13,14,NA)
d<-c(16,17,NA,19,20)
df<-data.frame(a,b,c,d)
df2<-dplyr::mutate(df,E=(a+b+c),na.rm=T)
I would love to have something like this:
df3<-dplyr::mutate(df,E=(a to c),na.rm=T)