library(tree)
library(party)
library(rpart)
library(rpart.plot)
library(RWeka)
df <- data.frame(stringsAsFactors=FALSE,
label = c(1,2,3,1,2,3,1,2,3,1),
pixel1 = c(1,0,0,1,0,1,0,0,0,1),
pixel2 = c(0,1,0,0,1,0,0,0,0,0),
pixel3 = c(1,4,0,0,1,0,1,0,1,0),
pixel4 = c(0,0,1,0,0,1,0,1,0,1),
pixel5 = c(0,0,1,0,1,0,1,0,1,0))
head(df)
splitPCT <- .25
splitRows <- nrow(df) * splitPCT
dataSplit <- sample(nrow(df), splitRows)
testData <- df[dataSplit,]
dim(testData)
decisionTree <- rpart(label ~ . , data = df, )
dtree1 <- tree(label ~ ., data = df)
decisionTree
dtree1