From 5ce29520f3ebd68a3ac2f64b186deb7e06111943 Mon Sep 17 00:00:00 2001 From: ddgarrett Date: Wed, 13 Jul 2016 14:44:33 -0700 Subject: [PATCH] run library(caret) earlier createDataPartition(...) requires library(caret). Therefore caret needs to be loaded sooner. --- 08_PracticalMachineLearning/019predictingWithTrees/index.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/08_PracticalMachineLearning/019predictingWithTrees/index.Rmd b/08_PracticalMachineLearning/019predictingWithTrees/index.Rmd index a3cccb90f..753c8dca2 100644 --- a/08_PracticalMachineLearning/019predictingWithTrees/index.Rmd +++ b/08_PracticalMachineLearning/019predictingWithTrees/index.Rmd @@ -145,6 +145,7 @@ table(iris$Species) ## Create training and test sets ```{r trainingTest, dependson="iris",cache=TRUE} +library(caret) inTrain <- createDataPartition(y=iris$Species, p=0.7, list=FALSE) training <- iris[inTrain,] @@ -167,7 +168,6 @@ qplot(Petal.Width,Sepal.Width,colour=Species,data=training) ## Iris petal widths/sepal width ```{r createTree, dependson="trainingTest", cache=TRUE} -library(caret) modFit <- train(Species ~ .,method="rpart",data=training) print(modFit$finalModel) ```