2

The Code is provided below:

df is my data set 128 x 5000

test_random  <- df[, sample(ncol(df), 32)] 
training_random <-  df[-test_random, ] 

Error message :

Error in df[test_random, ] :
only 0's may be mixed with negative subscripts

Any thoughts on how to display the training_random subset?

Sal-laS
  • 11,016
  • 25
  • 99
  • 169

1 Answers1

1

You have almost done it:

test_random  <- df[, -sample(ncol(df), 32)] 


ncol(test_random)
Sal-laS
  • 11,016
  • 25
  • 99
  • 169