This problem seems to have started when I updated to R
version 2.14.2 and ggplot2
version 0.9.0. When I load the ggplot2
package, it does not also load plyr
or reshape
, so I can't use, for example melt
. I have the packages installed, and required packages are loaded in other cases, it seems like only ggplot2
is affected.
> library(ggplot2)
> cushny$SubjID <- as.factor(LETTERS[1:nrow(cushny)])
> cushny.m <- melt(cushny, id="SubjID", measure=c("Control", "drug1", "drug2L", "drug2R"), variable.name="Condition", value.name="Sleep")
Error: could not find function "melt"
> library(lme4)
Loading required package: Matrix
Loading required package: lattice
Of course I can manually load the required packages, but that seems strange. Has anyone else encountered this problem? Any idea what went wrong?
http://cran.r-project.org/web/packages/ggplot2/NEWS
ggplot2 now uses a
NAMESPACE
, and only exports functions that should be user visible - this should make it play considerably more nicely with other packages in the R ecosystem. Note that this means you now need to explicitly loadplyr
(and other packages) if you are using them elsewhere in your code.
Basically, from version 0.9.0, the implementation was changed to avoid possible conflicts when multiple packages were loaded.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.