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

6

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 :)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.