Caret Package in R - createDataPartition() Function Not Found?
I Am Learning the Caret Package in R and I Am Trying to Run to Code in Max Kuhn's Paper "A Short Introduction to the Caret Package". When I Run the Following...
I am learning the CARET Package in R and I am trying to run to code in Max Kuhn's paper "A Short Introduction to the caret Package". When I run the following code, after successfully installing CARET:
data(Sonar)
set.seed(107)
# The outcome data are needed, the percentage of data in the training set & the format of the results
inTrain <- createDataPartition(y = Sonar$Class,p = .75, list = FALSE)
str(inTrain)
I get the following error that this function createDataPartition() is not found:
Error in createDataPartition(y = Sonar$Class, p = 0.75, list = FALSE) :
could not find function "createDataPartition"
> str(inTrain)
Error in str(inTrain) : object 'inTrain' not found
Any thoughts?
Best,
Mike
1 Answer
I had the same problem... The solution:
In your shell go to /var/folders/tn/f7md6x8j0b73tg9tp83hgm4r0000gn/T//RtmpChzV5D/downloaded_packages
cd /var/folders/tn/f7md6x8j0b73tg9tp83hgm4r0000gn/T//RtmpChzV5D/downloaded_packages
Look what you have there:
ls
If you have something like caret_6.0-80.tgz, you need to remove it:
sudo rm -r caret_6.0-80.tgz
I hope I've helped :)