--
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 consoleError 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 packageprettyTree(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.
|
|
|
To view this discussion on the web visit https://groups.google.com/d/msg/rattle-users/-/0yYY6UfFybsJ.
### 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.
--
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.