SyntaxFix
Write A Post
Hire A Developer
Questions
Try using rowMeans:
rowMeans
z$mean=rowMeans(z[,c("x", "y")], na.rm=TRUE) w x y mean 1 5 1 1 1 2 6 2 2 2 3 7 3 3 3 4 8 4 NA 4