6

Trying to run fancyrpartplot for the first time and running into errors.

> fancyRpartPlot(rpart.sub1)
Error in loadNamespace(name) : there is no package called ‘rpart.plot’

I've searched and searched but can't find a solution. I've tried removing rattle and RGtk2 and keep getting the same errors. Think its something to do with GTK+ but can't find anything that shows how to delete and reinstall GTK+

> remove.packages("RGtk2")
Removing package from ‘C:/Program Files/R/R-3.1.0/library’
(as ‘lib’ is unspecified)
> remove.packages("rattle")
Removing package from ‘C:/Program Files/R/R-3.1.0/library’
(as ‘lib’ is unspecified)

Restarting R session...

> install.packages("rattle")
also installing the dependency ‘RGtk2’

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/RGtk2_2.20.31.zip'
Content type 'application/zip' length 13914471 bytes (13.3 Mb)
opened URL
downloaded 13.3 Mb

trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/rattle_4.0.0.zip'
Content type 'application/zip' length 3728887 bytes (3.6 Mb)
opened URL
downloaded 3.6 Mb

package ‘RGtk2’ successfully unpacked and MD5 sums checked
package ‘rattle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\xxx\AppData\Local\Temp\RtmpsLxgOv\downloaded_packages
> require(RGtk2)
Loading required package: RGtk2
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Program Files/R/R-3.1.0/library/RGtk2/libs/x64/RGtk2.dll':
  LoadLibrary failure:  The specified module could not be found.

In addition: Warning message:
package ‘RGtk2’ was built under R version 3.1.3 
trying URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip'
Content type 'application/zip' length 25830230 bytes (24.6 Mb)
opened URL
downloaded 24.6 Mb

Learn more about GTK+ at http://www.gtk.org
If the package still does not load, please ensure that GTK+ is installed and that it is on your PATH environment variable
IN ANY CASE, RESTART R BEFORE TRYING TO LOAD THE PACKAGE AGAIN
Warning messages:
1: Failed to load RGtk2 dynamic library, attempting to install it. 
2: In dir.create(config_path, recursive = TRUE) :
  'C:\Program Files\R\R-3.1.0\library\RGtk2\gtk\x64\etc\gtk-2.0' already exists
> require(rattle)
Loading required package: rattle
Rattle: A free graphical interface for data mining with R.
Version 4.0.0 Copyright (c) 2006-2015 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
Warning message:
package ‘rattle’ was built under R version 3.1.3 
> fancyRpartPlot(rpart.sub1)
Error in loadNamespace(name) : there is no package called ‘rpart.plot’

Interestingly the file it says is missing C:/Program Files/R/R-3.1.0/library/RGtk2/libs/x64/RGtk2.dll is actually there, I've checked manually.

At this point I've removed rattle and RGtk2 several times. Each time RGtk2 installs GTK+ again but nothing changes.

Any help greatly appreciated.

edit: Should have maybe added that if I type rattle() rattle appears to load correctly.

SC.
  • 406
  • 1
  • 6
  • 13
  • 4
    install packages rpart and rpart.plot – phiver Nov 19 '15 at 11:13
  • @phiver `plot(rpart.sub1)` correctly plots the rpart created tree so I know rpart and rpart.plot are both installed and working properly. – SC. Nov 19 '15 at 14:24
  • 1
    @SC. plot(rpart.sub1) does not mean rpart.plot is available. It justs plots the rpart.sub1. plotting with rpart.plot means using the command prp (or rpart.plot::prp(rpart.sub1) – phiver Nov 19 '15 at 14:41
  • @phiver Thank you very much. Your 100% right I'm missing the package rpart.plot. Once I installed that, fancyrpartplot works perfectly. Wonder why it wasn't installed as a dependent. Oh well. Thank you again. – SC. Nov 19 '15 at 17:35

3 Answers3

6

Per @phiver rpart.plot was missing

SC.
  • 406
  • 1
  • 6
  • 13
2

Do according to the warning "Error in loadNamespace(name) : there is no package called ‘rpart.plot’", type: install.packages("rpart.plot").

CcMango
  • 377
  • 1
  • 4
  • 15
0

You search here:

https://cran.r-project.org/web/packages/rattle/vignettes/rattle.pdf

In this document the info is:

Rattle depends on over 40 other R packages and a couple of other software applications/libraries that are independent of R. The first thing to ensure is that you have installed the GTK+ libraries and the GGobi application. This is operating system dependent and full installation instructions are available from https://rattle.togaware.com/. Only a couple of R packages are dependencies for Rattle. Most are suggestions, but without them functionality is quite limited. At a minimum it is useful to ensure you have the RGtk2 package installed. Others that you might like to install include: ada, arules, doBy, ellipse, fBasics, fpc, gplots, Hmisc, kernlab, mice, party, playwith, pmml, randomForest, reshape, rggobi, RGtk2, ROCR, RODBC, and rpart.

The packages will usually be installed with the following command:

> install.packages("rattle", dependencies=c("Depends", "Suggests"))

The latest beta version of rattle is available from https://rattle.togaware.com/

> install.packages("rattle", repos="https://rattle.togaware.com", type="source")

Now you can use the command:

library(rattle)

and the output is:

Rattle: A free graphical interface for data science with R. Versión 5.5.1 Copyright (c) 2006-2021 Togaware Pty Ltd.

tripleee
  • 175,061
  • 34
  • 275
  • 318