Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find function colMedians [duplicate]

Tags:

r

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

like image 892
user5363938 Avatar asked Nov 14 '25 15:11

user5363938


1 Answers

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)
like image 117
Megatron Avatar answered Nov 17 '25 08:11

Megatron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!