You can use the sample.split() function from the caTools package for this purpose:
Start off by loading the 'caTools' package:
Then, use the sample.split() function which takes in two parameters -> the dataset - 'beaver1' and SplitRatio - 0.65
sample.split(beaver1,SplitRatio = 0.65)->mysplit
Following which, use the subset() function and select all those observations where 'mysplit' tag is True and store them in 'train'
Similarly, select all those observations where the 'mysplilt' tag is Fasle, and store them in 'test'
And that's how you split the data into 'train' and 'test' sets.