Am not sure whether I have fully understood the rowwise function in dplyr. I seem to get the expected results. Below is the code and the expected results.
library(dplyr)
set.seed(123)
mydf <- tibble(
a1 = floor(rnorm(10, 5, 2)),
a2 = floor(rnorm(10, 6, 3)),
a3 = floor(rnorm(10, 8, 3))
)
mydf %>%
rowwise() %>%
mutate(allmeanrow = mean(a1:a3))
# Expected
mydf %>%
mutate(allmeanrow = rowMeans(.))