Randomly Split a Dataset into Two Subsets
random_split.Rd
The function takes a dataset and splits it into two subsets randomly, based on a specified proportion.
Value
A list with two elements:
set1
The first subset of the dataset, containing
prop
proportion of the rows.set2
The second subset of the dataset, containing the remaining rows.
Examples
# Load a dataset
data(altmejd)
# A 70-30 simple random split
split <- random_split(altmejd, prop = 0.7)
# Access the subsets
set1 <- split$set1
set2 <- split$set2