0

What is the difference between these two lines of codes in R?

split = sample.split(dataset$Customer_Segment, SplitRatio = 0.8)

split = sample.split(dataset, SplitRatio = 0.8)
Ghalebani
  • 3
  • 1
  • From which package is `sample.split` function from? Did you look at it's documentation at `?sample.split` it should have more information about this – Ronak Shah Aug 02 '21 at 13:49

1 Answers1

0

if you mean caTools::sample.split, function is based on length value of object.

let's assume dataset has 100 rows and 10 columns

length(dataset$Customer_Segment) is 100 (equal to nrow(dataset)), so function return vector 80 TRUE and 20 FALSE value

since length(dataset) is 10 (equal to ncol(dataset)) so function return vector 8 TRUE and 2 FALSE

dy_by
  • 1,061
  • 1
  • 4
  • 13