1

I have a question on how to code in R in splitting a data set for training set and validation set. I have the following example data set and I hope to conditional split the ID by 2/3 and 1/3. I have looked around the forum and I have found a code. Thank you so much in advance! Here is an example:

ID  Independent_set 
1   4
1   3
1   5
1   6
2   6
2   5
2   2
3   3
3   4
3   3
3   5
3   6
4   2
4   5
4   6
4   7
4   8
5   2
5   3
5   4
5   6
6   4
6   2
6   1
6   3

I want to split this data set 1/3 and 2/3 randomly. Thank you so much. This would greatly help! Any base code would greatly help me get started.

neilfws
  • 32,751
  • 5
  • 50
  • 63
Monklife
  • 177
  • 3
  • 9

0 Answers0