IDNLearn.com offers a seamless experience for finding and sharing knowledge. Our platform is designed to provide reliable and thorough answers to all your questions, no matter the topic.
```{r}
boxplots <- function(dataframe){ #creates a box plot of all provided data broken down by column name
par(mar=c(7,5,1,1))
boxplot(dataframe)
}
boxplots(dataframe)
boxplotspec <- function(dataframe){ #creates a box plot for each species
dfsub1 <- subset(dataframe, Species == "versicolor")
dfsub2 <- subset(dataframe, Species == "setosa")
dfsub3 <- subset(dataframe, Species == "virginica")
par(mfrow=c(1,3),mar=c(6,3,2,1))
boxplot(dfsub1[,1:4], main="Versicolor",ylim = c(0,8),las=2)
boxplot(dfsub2[,1:4], main="Setosa",ylim = c(0,8),las=2)
boxplot(dfsub3[,1:4], main="Virginica",ylim = c(0,8),las=2)
}
boxplotspec(dataframe)
histplot <- function(dataframe){ #creates a histogram of all species using the data provided
hist(dataframe$Petal.Length)#to change the data in the plots, replace "Petal.Length" with the desired data column name
par(mfrow=c(1,3))
}
histplot(dataframe)
histplotsspec <- function(dataframe){ #creates histograms of each species.
dfsub1 <- subset(dataframe, Species == "versicolor")
dfsub2 <- subset(dataframe, Species == "setosa")
dfsub3 <- subset(dataframe, Species == "virginica")
hist1 <- hist(dfsub1$Petal.Length,breaks=seq(0,8,l=17),xlim=c(0,8),ylim=c(0,40))
hist2 <- hist(dfsub2$Petal.Length,breaks=seq(0,8,l=17),xlim=c(0,8),ylim=c(0,40))
hist3 <- hist(dfsub3$Petal.Length,breaks=seq(0,8,l=17),xlim=c(0,8),ylim=c(0,40))
#to change the data in the plots, replace "Petal.Length" with the desired data column name
}
histplotsspec(dataframe)
treeunprun <- function(dataframe){ #creates an unpruned decision tree from the data
input <- dataframe[,1:4]
output <- dataframe[,5]
model1 <- C5.0(input, output, control = C5.0Control(noGlobalPruning = TRUE,minCases=1))
plot(model1, main="C5.0 Decision Tree - Unpruned, min=1")
}
treeunprun(dataframe)
treeprun <- function(dataframe){ #creates a pruned decision tree from the data
input <- dataframe[,1:4]
output <- dataframe[,5]
model2 <- C5.0(input, output, control = C5.0Control(noGlobalPruning = FALSE))
plot(model2, main="C5.0 Decision Tree - Pruned")
}
treeprun(dataframe)
```
Quitting from lines 45-94 (6,2-FunctionsRMARKDOWN.Rmd)
Error in eval(parse(text = paste(obj$call)[xspot])) :
object 'input' not found
Calls: ... as.party -> as.party.C5.0 -> data.frame -> eval -> eval
We appreciate your presence here. Keep sharing knowledge and helping others find the answers they need. This community is the perfect place to learn together. IDNLearn.com has the solutions you’re looking for. Thanks for visiting, and see you next time for more reliable information.