Error: could not find function "sample.split"

classification

#1

I am currently solving one classification problem for which I am trying to split the training data into training and testing of my model for which I am using the sample.split function but I am getting the error.

sample_0 = sample.split(train_0, SplitRatio = .9) 
Error: could not find function "sample.split"

#2

Have you imported the caTools library?


#3

You have to download and include the library caTools before executing sample split.


#4

I am facing the same problem on my mac. I have imported caTools library and checked for its presence too. But when i check whether sample.split is defined, it shows “False”. Any possible solution for this?


#5

I encountered the same problem. After installing the package caTools, make sure you load its library as well before running the code.

install.package("caTools")
library(caTools)