TL16
TL16

Reputation: 71

geom_smooth method="rlm" object 'rlm' of mode 'function' was not found

ggplot(data, aes(x, y))+
 geom_point(na.rm=T)+
 geom_smooth(method="rlm", se=T)

error message: Computation failed in stat_smooth(): object 'rlm' of mode 'function' was not found

Do I need to download any package for rlm? why do I get this message

Upvotes: 4

Views: 2164

Answers (1)

Gregor Thomas
Gregor Thomas

Reputation: 145775

You've already downloaded the package (automatically when you installed ggplot). You just need to load it with library(MASS).

A few ways to find functions in packages:

  • help("rlm", try.all.packages = T) is a great way to find function in installed packages. No internet access needed!

  • Searching for "ggplot rlm" does a pretty good job with in a search engine. My first hit was an example that had the library(MASS) line.

  • You can search for functions on https://www.rdocumentation.org/. There's actually a package called rlm (that might work with ggplot, I'm not sure), but since you're using ggplot you need only look at packages that are in the Imports or Suggests fields in the ggplot2 description (CRAN link)

Of course, it would be nice if there was a helpful message or this was mentioned in the geom_smooth documentation. Or if it wasn't necessary at all.

Upvotes: 4

Related Questions