public
Created

windows.r

  • Download Gist
README.md
Markdown

Installing rggobi

The two scripts below give the most up-to-date instructions for installing rggobi on windows and mac. They should install everything you need, from Gtk2 to ggobi to rggobi.

To install:

  • On windows, copy and paste windows.r into R, and then run install_all().

  • On the mac, open the terminal, and copy and paste the commands from mac.sh below

If you have problems, try:

  • Installing the latest version of R

  • (On windows) Running R as administrator (right click on the shortcut to R and click "Run as administrator")

If you still have problems, please email the ggobi mailing list, providing any error messages as well as the output from sessionInfo() in R.

mac.sh
Shell
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# Install gtk
curl -O http://r.research.att.com/libs/GTK_2.18.5-X11.pkg
open GTK_2.18.5-X11.pkg
# Install ggobi
curl -O http://r.research.att.com/libs/ggobi-2.1.8-darwin9-bin3.tar.gz
sudo tar fvxz ggobi-2.1.8-darwin9-bin3.tar.gz -C /
 
# Install rggobi
export PATH=/usr/local/ggobi/bin:/Library/Frameworks/GTK+.framework/Resources/bin:$PATH
export PKG_CONFIG_PATH=/usr/local/ggobi/lib/pkgconfig:/Library/Frameworks/GTK+.framework/Resources/lib/pkgconfig
 
R
install.packages("rggobi", type = "source")
windows.r
R
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
## depending on where you installed GTK+, you may need to run this script as administrator
## (right click on the shortcut of R --> Run as administrator)
 
#' @param reinstall If TRUE, reinstall everything
install_all <- function(reinstall = FALSE) {
oldwd <- setwd(tempdir())
on.exit(setwd(oldwd))
cran <- "http://cran.r-project.org/"
# Gtk and RGtk2 ------------------------------------------------------------
if (!is_installed("gtk") || reinstall) {
message("Installing Gtk")
url <- "http://downloads.sourceforge.net/gtk-win/gtk2-runtime-2.22.0-2010-10-21-ash.exe?download"
download.file(url, basename(url), mode = "wb")
shell.exec(basename(url))
}
if (!is_installed("rgtk2") || reinstall) {
message("Installing RGtk2")
install.packages("RGtk2", repos = cran)
}
 
# Missing dlls -------------------------------------------------------------
gtk_path <- dirname(Sys.which("libcairo-2.dll"))
if (!is_installed("libxml2")) {
message("Installing libxml2")
url <- "http://yihui.name/fun/libxml2.dll"
download.file(url, file.path(gtk_path, "libxml2.dll"), mode = "wb")
}
if (!is_installed("iconv")) {
message("Installing iconv")
url <- "http://yihui.name/fun/iconv.dll"
download.file(url, file.path(gtk_path, "iconv.dll"), mode = "wb")
}
# GGobi and rggobi ---------------------------------------------------------
if (!is_installed("ggobi") || reinstall) {
message("Installing GGobi")
ggobi.url <- "http://www.ggobi.org/downloads/ggobi-2.1.8.exe"
download.file(ggobi.url, basename(ggobi.url), mode = "wb")
shell.exec(ggobi.exe)
}
if (!is_installed("rggobi") || reinstall) {
message("Installing rggobi")
install.packages("rggobi", repos = cran)
}
 
message("Installation completed. Run the following code to test")
message("library(rggobi); ggobi(mtcars)")
}
 
is_installed <- function(pkg) {
in_path <- function(x) length(Sys.which(x)) > 0
pkg_installed <- function(x) system.file(package = x) != ""
switch(pkg,
ggobi = in_path("ggobi"),
rggobi = pkg_installed("rggobi"),
gtk = in_path("libcairo-2.dll"),
rgtk2 = pkg_installed("RGtk2"),
libxml2 = in_path("libxml2.dll"),
iconv = in_path("iconv.dll")
)
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.