Questions tagged [rpart]

An R package for fitting classification and regression trees.

rpart is an package for fitting and trees ().

Repositories

Vignettes

Other resources

Related tags

445 questions
0
votes
0 answers

rpart package in R - decision tree giving incorrect labels of numbers of rows ('n = ###') in each leaf node

I'm using the rpart package in R to create a decision tree model out of a data frame called 'myData'. It has 85,590 rows. The decision tree is created using code like this (the key part is that 'data = myData'): decTree <- rpart(outcome ~ var1 +…
Ward W
  • 640
  • 6
  • 14
0
votes
1 answer

Formulate data for rpart

Concatenate columns name of a list to prepare a formula for rpart? Just wanted to concatenate the names(log_data), log_data is a list of 60 vectors distinct vectors, so I just want their column names in a format so that I can put them in a formula…
Aashu
  • 1,247
  • 1
  • 26
  • 41
-1
votes
1 answer

Number of rows in matrices must match (see arg 2) - rpart

I'm trying to analyse some tennis data and I'm hitting a problem with the code: library(rpart) library(rpart.plot) library(ggplot2) library(wesanderson) train=read.csv("/ags_test.csv",header=T, na.strings=c("","NA")) Please note this is a complete…
-1
votes
1 answer

with quotation mark and without quotation mark, what is the difference

For the following code, I wish to find the minimun cp item which has the lowest xerror data(iris) install.packages("rpart") library(rpart) set.seed(161) tree.model1<-rpart(Sepal.Length~., data =…
Mathilda Fang
  • 353
  • 1
  • 13
-1
votes
1 answer

show labels instead of the variable names in rpart.plot?

I have plotted a tree and ideally, I want the tree to show all the labels of the variables. For example, show "Time Spent Reading" (my labels to the variable) instead of "time_reading" (the variable). Particularly, so far, I use the package…
Sherry Fu
  • 1
  • 1
-1
votes
1 answer

How do you get the conditional colour shading in the each node using rpart.plot?

I was using the below code, and in the output I was getting a nice conditional shading in each node, depending on the %age of the Target variable (Y/N). Higher the % of Y, darker the shade of green and higher the %age of N, darker the shade of…
-1
votes
1 answer

cannot predict from rpart

I have a matrix of features (in columns) where the last column is a class label. Observations are in rows. I use rpart in R to build a decision tree over a subset of my data and test it with predict using the rest of the data. The code to learn the…
capella
  • 5
  • 1
-1
votes
1 answer

R:More than 52 levels in a predicting factor, truncated for printout

Hi I'm a beginner in R programming language. I wrote one code for regression tree using rpart package. In my data some of my independent variables have more than 100 levels. After running the rpart function I'm getting following warning message…
R Learner
  • 545
  • 1
  • 7
  • 13
-2
votes
1 answer

Names of selected features in pruned RPART tree

I would like to get the names of the features being used in my pruned RPART tree. I can read the names off the plotted pruned tree, but I prefer a vector of names. Is there a way to do this?
Neal Oden
  • 57
  • 4
-3
votes
2 answers

only one leaf forming in rpart plot

click here for the outputi tried the code below for caret train an rpart plot but only one leaf is formiong can anyone tell why is this happening the code i tried is making a caret train control set and then made a rpart train set along with the…
1 2 3
29
30