如何编写一个 R 代码来计算 Excel 文件的行平均数?

How to write an R code which calculates the row-wise mean from an Excel file?

以下是我的数据示例:

Dates   User1   User2   User3
Jan-15  10        54    1
Feb-15  25        85    25
Mar-15  69        65    65
Apr-15  56        32    41

我不想在 excel 文件中手动进行任何更改。 如何编写 R 代码来计算一月、二月、三月和四月的各自均值。

使用例如readxl 包:

library(readxl)
df <- read_excel(filename, sheetnumber)
rowMeans(df[, -1])
# [1] 21.66667 45.00000 66.33333 43.00000