rowmeans | R Documentation |
Does what rowMeans()
does but without having to cbind the variables. Makes it easier to use
with the tidyverse
rowmeans(..., na.rm = FALSE)
... |
the variables (unquoted) to be included in the row means |
na.rm |
should the missing values be ignored? default is FALSE |
the row means
## Not run:
library(furniture)
library(tidyverse)
data <- data.frame(
x = sample(c(1,2,3,4), 100, replace=TRUE),
y = rnorm(100),
z = rnorm(100)
)
data2 <- data %>%
mutate(y_z_mean = rowmeans(y, z))
data2 <- data %>%
mutate(y_z_mean = rowmeans(y, z, na.rm=TRUE))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.