Skip to content

Instantly share code, notes, and snippets.

@kohske
Created August 17, 2011 06:34
Show Gist options
  • Save kohske/1150934 to your computer and use it in GitHub Desktop.
Save kohske/1150934 to your computer and use it in GitHub Desktop.
How to install development version of ggplot2
# install devtools
install.packages('devtools')
# install dependency of scales package
install.packages(c("RColorBrewer", "stringr", "dichromat", "munsell", "plyr", "colorspace"))
# load devtools
library(devtools)
# move to development mode
# scales and ggplot2 are installed in "~/R-dev" directory, so official version of ggplot2 are not removed.
dev_mode(TRUE)
install_github("scales")
# main branch of development
install_github("ggplot2", "hadley", "develop")
#install_github("ggplot2", "kohske", "feature/new-guides-with-gtable")
# load development version of ggplot2
library(ggplot2)
@airportpeople
Copy link

CORRECTION:

After loading this, I had a few errors, since some of the parameters in install_github are deprecated. This worked for me:

# install devtools
install.packages('devtools')

# install dependency of scales package
install.packages(c("RColorBrewer", "stringr", "dichromat", "munsell", "plyr", "colorspace"))

# Open devtools package
library(devtools)

# move to development mode
# scales and ggplot2 are installed in "~/R-dev" directory, so official version of ggplot2 are not removed.
dev_mode(TRUE)

install_github("hadley/scales", force=TRUE)
# main branch of development
install_github("hadley/ggplot2")
# (Optional) install_github("ggplot2", "kohske", "feature/new-guides-with-gtable")

# Exit dev mode
dev_mode(FALSE)

# load development version of ggplot2
library(ggplot2)

@raffacabofrio
Copy link

Tried to folow ltjds script. Dont have errors. But dev ggplot2 is not being used.

@kesireddy007
Copy link

I am trying to install ggplot2 dev version to use ggplotly function, following ltjds code above. However, I get the following error, it succeeds till few steps like creating "~/R-dev" directory, installing scales and ggplot2 in that folder. However, at the testing if installed package can be loaded step, I get errors, as shown below.
Error : .onAttach failed in attachNamespace() for 'ggplot2', details:
call: NULL
error: 'with_preserve_seed' is not an exported object from 'namespace:withr'
Error: loading failed
Execution halted
ERROR: loading failed

  • removing 'C:/Users/venu_/Documents/R-dev/ggplot2'
    Installation failed: Command failed (1)
    So , only scales package now remains in ~/R-dev" directory. Unable to figure out , what needs to be done.
    Regular ggplot2 package in the R Directory works fine.

@kamingfung
Copy link

kamingfung commented May 8, 2018

@raffacabofrio
Having updated to R v3.5, I need to reinstall ggplot2 from the source.
I can now use the dev ggplot2 only when dev_mode=TRUE.
Maybe you can try again with dev_mode on.

@brennanpincardiff
Copy link

brennanpincardiff commented Jun 13, 2018

Thanks for this - very helpful.
To make it all work, I also had to install the Rcpp and rlang packages.
My aim was to test the development version of ggplot2 (ggplot2_2.2.1.9000) with my Bioconductor package drawProteins_1.0.0.
Happily it all worked. I assembled the package vignette and all the figures look correct.
The session info showed that I was using the development version of ggplot2.
I couldn't have done it without the advice here.
Thanks again.

@kristeesong
Copy link

I get this error even when dev_mode is on:

restarting interrupted promise evaluation
internal error -3 in R_decompress1Error: package or namespace load failed for ‘ggplot2’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ggplot2/R/ggplot2.rdb' is corrupt

I believe it's saying my original file is corrupt, but I'm not sure. What should I do?

@yash-bhatt
Copy link

I get this error even when dev_mode is on:

restarting interrupted promise evaluation
internal error -3 in R_decompress1Error: package or namespace load failed for ‘ggplot2’ in get(method, envir = home):
lazy-load database '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/ggplot2/R/ggplot2.rdb' is corrupt

I believe it's saying my original file is corrupt, but I'm not sure. What should I do?

Yes even I am getting same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment