4

I have seen this, and I have added the package MatrixStats.

But when I run the code

colMeans(adult_csv[5], na.rm = TRUE)
colMedians(adult_csv[5], na.rm = TRUE)

it passes the first line, but complains with colMedians with:

R: could not find function colMedians

lmo
  • 37,904
  • 9
  • 56
  • 69
user5363938
  • 831
  • 3
  • 17
  • 32

1 Answers1

8

colMeans() is in base and colMedians is in the matrixStats package.

find("colMedians")
#  [1] "package:matrixStats"
find("colMeans")
#  [1] "package:base"

Attach the package first:

library(matrixStats)
colMeans(adult_csv[5], na.rm = TRUE)
colMedians(adult_csv[5], na.rm = TRUE)
Megatron
  • 15,909
  • 12
  • 89
  • 97