Re: error messages from Rattle 2.6.21

2,057 views
Skip to first unread message

Graham Williams

unread,
Oct 9, 2012, 3:57:00 PM10/9/12
to rattle...@googlegroups.com
Hi YKE,

The problem you describe below sounds like there was an issue with the installation of the GTK+ package. 

How was that installed? (It is a separate install to R and Rattle but is picked up to be installed when Rattle starts up the first time)

Are you able to uninstall the GTK+ package and try installing it again perhaps?

Regards,
Graham



On 10 October 2012 02:19, YKE <ya...@alumni.princeton.edu> wrote:


Hi,

I am teaching myself data mining with R. I started using your Rattle package along with the book
"Data mining with Rattle and R".

It was working nicely, but I got into an issue with it not retrieving previously saved .rattle projects.
So I updated to R 2.15.1 and Rattle 2.6.21

I use Windows XP and RStudio interface.

I am now getting a lot of error messages from Rattle and it did not produce a tree plot.

(I am a beginner in all aspects of this: installing R and integrating it into my PC, using Rattle, etc.)



As per your advice on an earlier posting, I started with a blank .RData.

Here is what happened when I started my session:

>
ls() character(0) > library("rattle") Rattle: A free graphical interface for data mining with R. Version 2.6.21 Copyright (c) 2006-2012 Togaware Pty Ltd. Type 'rattle()' to shake, rattle, and roll your data. > rattle() (rsession.exe:4508): Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local (rsession.exe:4508): Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local

## I read a .csv file into R dataframe and did a couple of manipulations
# In the dataframe using just plain R

## I then went into Rattle "Data" tab and asked it to download the dataset. I got the following error
#on the console:


(rsession.exe:4508): Gtk-WARNING **: Could not find the icon 'gtk-file'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

## I went to the freedesktop.org/releases and downloaded hicolor-icon-theme-0.12.tar
# But did not take any action because, to be honest, I was not sure
# What exactly I should do
# The instructions in README of the tar filed seemed to be for UNIX, not Windows

## I then went back to R and Rattle and tried to do a histogram and a cumulative plot of one of the variables in the data set.
# that worked fine

## I then fit a tree and that worked fine
# but when I hit the draw button on the Model tab it brings up a blank plotting window
# and the following error on console


Error in apply(model$frame$yval2[, yval2per], 1, function(x) x[1 + x[1]]) : 
  dim(X) must have a positive length

## However, I am able to draw the tree fine using an R function from DMwR package

prettyTree(crs$rpart)

--------------------------------------------------

I would greatly appreciate your help. I really like Rattle and would like to get it to work on my PC.

YKE



--
You received this message because you are subscribed to the Google Groups "rattle-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rattle-users/-/0Es1oyiP95sJ.
To post to this group, send email to rattle...@googlegroups.com.
To unsubscribe from this group, send email to rattle-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rattle-users?hl=en.

YKE

unread,
Oct 9, 2012, 7:19:13 PM10/9/12
to rattle...@googlegroups.com
Hi Graham,

Thank you very much for your reply. I was not able to find a GTK+ package. After some googling I figured you might be talking about RGtk2 package. I uninstalled it, and also unistalled Rattle.

I then installed RGTk2 package and then installed Rattle.

Rattle popped up a small window telling me it is mising a GTK+ package and asked me if I wanted to instal it. I clicked on "install" option. But then I got an error message from Rattle.

I quit R, restarted it and got a different error message. Plotting a tree from rattle still does not work, though using plot(crs$rpart) from the console works fine.

The transcript of my 2 sessions is below:

______________________________________________________
Error in loadNamespace(name) : there is no package called ‘rattle’
Error in loadNamespace(name) : there is no package called ‘rattle’

> install.packages("RGtk2")
Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.15/RGtk2_2.20.25.zip'
Content type 'application/zip' length 13764401 bytes (13.1 Mb)
opened URL
downloaded 13.1 Mb

package ‘RGtk2’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	D:\Documents and Settings\ykaneesr\Local Settings\Temp\Rtmp8UJTpn\downloaded_packages
> install.packages("rattle")
Installing package(s) into ‘C:/Program Files/R/R-2.15.1/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.wustl.edu/bin/windows/contrib/2.15/rattle_2.6.21.zip'
Content type 'application/zip' length 2512511 bytes (2.4 Mb)
opened URL
downloaded 2.4 Mb

package ‘rattle’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
	D:\Documents and Settings\ykaneesr\Local Settings\Temp\Rtmp8UJTpn\downloaded_packages
> library("rattle")
Rattle: A free graphical interface for data mining with R.
Version 2.6.21 Copyright (c) 2006-2012 Togaware Pty Ltd.
Type 'rattle()' to shake, rattle, and roll your data.
> rattle()
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Program Files/R/R-2.15.1/library/RGtk2/libs/i386/RGtk2.dll':
  LoadLibrary failure:  The specified module could not be found.

trying URL 'http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip'
Content type 'application/zip' length 24516284 bytes (23.4 Mb)
opened URL
downloaded 23.4 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

(rsession.exe:5588): Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local
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-2.15.1\library\RGtk2\gtk\i386\etc\gtk-2.0' already exists

(rsession.exe:5588): Gtk-WARNING **: Could not find the icon 'gtk-file'. The 'hicolor' theme
was not found either, perhaps you need to install it.
You can get a copy from:
	http://icon-theme.freedesktop.org/releases

>

### Here I quit R and started it again.

> rattle()

(rsession.exe:4292): Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local

#I loaded pre-existing .rattle project where I fit a decision tree
#Once again, when I hit the draw button I just get an empty plotting window.
plot(crs$rpart) from the console works fine.


>




____________________________________________________

Graham Williams

unread,
Oct 10, 2012, 3:45:43 PM10/10/12
to rattle...@googlegroups.com
GTK+ is the non-R and non-Rattle package that provides the GUI.

RGtk2 is the R package that provides the interface to the GTK+ library.

It looks like you have RGtk2 (and thus GTK+) installed properly now (else you would get no GUI interface).

The problem with the plotting looks like an issue.

Could you provide the steps/data you undertake to repeat the error and provide the error message.

Does it only happen when you load a .rattle project file?

Thanks,
Graham



To view this discussion on the web visit https://groups.google.com/d/msg/rattle-users/-/0yYY6UfFybsJ.

YKE

unread,
Oct 10, 2012, 4:40:14 PM10/10/12
to rattle...@googlegroups.com
Hello Graham,

I appreciate your follow-up. Thank you!

The problem with using the draw button to plot the tree persists regardless of whether I load a .rattle projects or load in a data set from .RData.

I got a bit further in your book and learned about conditional trees. I tried that and the draw button worked fine!

Below is the detailed transcript.

By the way, I read up on rpart and party packages as your book suggests and have a question about using "poisson" option (either in Rattle or in R in general). This is not covered in your book, but maybe you can tell me  whether I am on the right track or not.  I have a data set where the target variable is a number of times a certain question on a survey received a "yes" answer. The surveys pertain to events that may be attended by one person or multiple people. Sometimes we get only 1 survey per event. Sometimes several different people who participated in the same event fill out surveys (one survey per person). I want to use the number of "yes" answers that  an event received as a target variable and use a bunch of other variables (some categorical and some numerical) as predictors. Clearly, the number of yes votes depends on how many surveys we have filled out for that event (in addition to potentially depending on other predictors, such as where it was held, what kind of event, etc.) because id we had only 1 survey, then we can only get a maximum of 1 yes answer, while if we got 3 surveys for an event we can get up to 3 yes votes. I get an impression that I should use "poisson" model in rpart and make "y variable" be a 2 column variable with 1 column being the number of "yes" votes we got  for a given individual event and the other column being the number of surveys filled out for that event. I get an impression that I do not have that option in the ctree package (so I cannot use the nice plot that the draw button produces for the conditional tree). Does this seem right?

Many thanks!

Here is the R transcript
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### On console:

Attempting to load the environment ‘package:rattle’

Rattle: A free graphical interface for data mining with R.

Version 2.6.21 Copyright (c) 2006-2012 Togaware Pty Ltd.

Type 'rattle()' to shake, rattle, and roll your data.

[Workspace loaded from .RData]

 

> rattle()

 

(rsession.exe:2256): Gtk-WARNING **: Unknown property: GtkMenuBar.ubuntu-local

 

######################################################

# On Rattle (here is the log of what I did)

 

Rattle is Copyright (c) 2006-2012 Togaware Pty Ltd.

 

#============================================================

# Rattle timestamp: 2012-10-10 15:57:00 i386-pc-mingw32

 

# Rattle version 2.6.21 user '*****'

## Note: I masked out the user name after I copied the log into this message

 

# Export this log textview to a file using the Export button or the Tools

# menu to save a log of all activity. This facilitates repeatability. Exporting

# to file 'myrf01.R', for example, allows us to the type in the R Console

# the command source('myrf01.R') to repeat the process automatically.

# Generally, we may want to edit the file to suit our needs. We can also directly

# edit this current log textview to record additional information before exporting.

 

# Saving and loading projects also retains this log.

 

library(rattle)

 

# This log generally records the process of building a model. However, with very

# little effort the log can be used to score a new dataset. The logical variable

# 'building' is used to toggle between generating transformations, as when building

# a model, and simply using the transformations, as when scoring a dataset.

 

building <- TRUE

scoring  <- ! building

 

# The colorspace package is used to generate the colours used in plots, if available.

 

library(colorspace)

 

# A pre-defined value is used to reset the random seed so that results are repeatable.

 

crv$seed <- 42

 

#============================================================

# Rattle timestamp: 2012-10-10 15:58:55 i386-pc-mingw32

 

# Load an R data frame.

 

crs$dataset <- ppe

 

# Display a simple summary (structure) of the dataset.

 

str(crs$dataset)

 

#============================================================

# Rattle timestamp: 2012-10-10 15:58:57 i386-pc-mingw32

 

# Note the user selections.

 

# Build the training/validate/test datasets.

 

set.seed(crv$seed)

crs$nobs <- nrow(crs$dataset) # 986 observations

crs$sample <- crs$train <- sample(nrow(crs$dataset), 0.7*crs$nobs) # 690 observations

crs$validate <- sample(setdiff(seq_len(nrow(crs$dataset)), crs$train), 0.15*crs$nobs) # 147 observations

crs$test <- setdiff(setdiff(seq_len(nrow(crs$dataset)), crs$train), crs$validate) # 149 observations

 

# The following variable selections have been noted.

 

crs$input <- c("proj.id", "bot2.num", "aver.score", "quarter",

     "num.responses", "bot2.prct", "bg", "region",

     "proj.type", "proj.status", "surv.method", "BD",

     "RU", "bot2.binary.fact", "contract")

 

crs$numeric <- c("bot2.num", "aver.score", "quarter", "num.responses",

     "bot2.prct")

 

crs$categoric <- c("proj.id", "bg", "region", "proj.type",

     "proj.status", "surv.method", "BD", "RU",

     "bot2.binary.fact", "contract")

 

crs$target  <- "bot2.binary"

crs$risk    <- NULL

crs$ident   <- NULL

crs$ignore  <- NULL

crs$weights <- NULL

 

#============================================================

# Rattle timestamp: 2012-10-10 15:59:32 i386-pc-mingw32

 

# Note the user selections.

 

# The following variable selections have been noted.

 

crs$input <- c("quarter", "num.responses", "bot2.prct", "bg",

     "region", "proj.type", "proj.status", "surv.method",

     "BD", "RU", "bot2.binary.fact", "contract")

 

crs$numeric <- c("quarter", "num.responses", "bot2.prct")

 

crs$categoric <- c("bg", "region", "proj.type", "proj.status",

     "surv.method", "BD", "RU", "bot2.binary.fact",

     "contract")

 

crs$target  <- "aver.score"

crs$risk    <- NULL

crs$ident   <- "proj.id"

crs$ignore  <- c("bot2.binary", "bot2.num")

crs$weights <- NULL

 

#============================================================

# Rattle timestamp: 2012-10-10 15:59:43 i386-pc-mingw32

 

# Decision Tree

 

# The 'rpart' package provides the 'rpart' function.

 

require(rpart, quietly=TRUE)

 

# Reset the random number seed to obtain the same results each time.

 

set.seed(crv$seed)

 

# Build the Decision Tree model.

 

crs$rpart <- rpart(aver.score ~ .,

    data=crs$dataset[, c(crs$input, crs$target)],

    method="anova",

    parms=list(split="information"),

    control=rpart.control(usesurrogate=0,

        maxsurrogate=0))

 

# Generate a textual view of the Decision Tree model.

 

rattle.print.rpart(crs$rpart)

printcp(crs$rpart)

cat("\n")

 

# Time taken: 0.08 secs

 

# List the rules from the tree using a Rattle support function.

 

asRules(crs$rpart)

 

#============================================================

# Rattle timestamp: 2012-10-10 16:00:33 i386-pc-mingw32

 

# Plot the resulting Decision Tree.

 

# We use the rpart.plot package.

 

fancyRpartPlot(crs$rpart, main="Decision Tree ppe $ aver.score")

 

####################

 

# a blank plotting window popped up.

#On console I did

> plot(1:10, 1:10)

#Appropriate plot  appeared in the pop up window

#I closed the pop-up window and did

> plot(crs$rpart)

> text(crs$rpart)

#I got appropriate tree plot in the usual plotting window of RStudio

#I then tried the rattle plotting command on console and got this

> fancyRpartPlot(crs$rpart, main="Decision Tree ppe $ aver.score")

Error in apply(model$frame$yval2[, yval2per], 1, function(x) x[1 + x[1]]) :

  dim(X) must have a positive length

 

### I then tried building the conditional tree in Rattle and used the draw button. That worked fine!

#============================================================

# Rattle timestamp: 2012-10-10 16:10:15 i386-pc-mingw32

 

# Conditional inference tree.

 

# Build a conditional tree using the party package.

 

require(party, quietly=TRUE)

 

# Build a ctree model.

 

crs$rpart <- ctree(aver.score ~ ., data=crs$dataset[,c(crs$input, crs$target)])

 

# Generate summary of the ctree model.

 

print(crs$rpart)

 

# Time taken: 0.41 secs

 

#============================================================

# Rattle timestamp: 2012-10-10 16:10:44 i386-pc-mingw32

 

# Plot the resulting Decision Tree.

 

# We use the party package.


Graham Williams

unread,
Oct 11, 2012, 5:52:02 AM10/11/12
to rattle...@googlegroups.com
Thanks YKE. We might take the debugging off the mailing list - looks like there may be a bug in fancyRpartPlot. I can't replicate it yet (works just fine for my various test data) but I'll email you separately to see how we might debug it.

Regards,
Graham



--
You received this message because you are subscribed to the Google Groups "rattle-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rattle-users/-/qJTOghhJtDYJ.
Reply all
Reply to author
Forward
0 new messages