Reputation: 13
I am working on a problem set for ggplot2 in R. One of my questions asks for a scale log transformation, which both my notes and the Hadley Wickam book say can be done through this function:
scale_x_log()
However, when I use this function, R does not recognize it. Any time I use it, it gives me this error response:
Error: could not find function "scale_x_log"
When I use the help function, "?scale_x_log"
, it returns this error message:
No documentation for ‘scale_x_log’ in specified packages and libraries:
you could try ‘??scale_x_log’
The "??scale_x_log"
page takes me to "ggplot2::scale_x_continuous"
, which lists the function "scale_x_log10()"
. I am wondering if the function I am using doesn't exist, though this does not seem likely to me. I am also wondering if I need to download another package or something. I hope this question is clear....
Upvotes: 1
Views: 3611
Reputation: 558
The book of Hadley is already quite old in regards to dynamics in programming. To my experience ggplot2 is quite a dynamic package and these details often change (also see questions referring to how to turn the labels on the axis). Due to that I prefer to check stuff like that on the ggplot website first. This website is kept up to date with all changes in ggplot functions and is also displaying all the plots given in the examples.
The general page can be found here and the specific page for the log scale here. Indeed you have to use the scale_x_log10()
function now.
Upvotes: 1