-1

So what I did was make a partition of 40%-60%. The 40% worked, but not the 60%.

> dim(clean_reg)
[1] 497  23
> partition = sample(x = 1:497, size = .4*497, replace=F)
> dog = clean_reg[partition, ]
> cat = clean_reg[!partition, ]
> dim(dog)
[1] 198  23
> dim(cat)
[1]  0 23

Why didn't the remaining 60% go into cat? Doesn't ! sufficiently do that?

Hutchins
  • 85
  • 1
  • 3
  • 8
  • 1
    See this question from 1 hour ago http://stackoverflow.com/questions/26881622/how-to-write-the-remaining-data-frame-in-r-after-randomly-subseting-the-data – user20650 Nov 12 '14 at 08:50

1 Answers1

2

cat = clean_reg[-partition, ] instead of cat = clean_reg[!partition, ]

Cath
  • 23,906
  • 5
  • 52
  • 86