I currently have a table in R with 4 columns and I want to average the last two columns (titled W10CP1 and W10CP2) into a 5th column of that table.
I tried to use rowMeans but I got an error.
Sorry for the basic question!
I currently have a table in R with 4 columns and I want to average the last two columns (titled W10CP1 and W10CP2) into a 5th column of that table.
I tried to use rowMeans but I got an error.
Sorry for the basic question!
You can try use the tydeverse package here an example:
library(tidyverse)
data<-data%>%
mutate(mean= (data[,-1] +data[,-2]/2))