I have a rather large dataset test_data
with more than 30'000 observations and 20 variables.
I would like to make smaller subsets based on the number of the set, which is determined under test_data$set
. The size of the subset will vary (as shown below).
For a small dataset, I would subset the rows as follows:
test_data <- data.frame(measurement=c(2,34,5,6,7,38,3,4,29,11,12,4,5,6,91,13,13,13,12))
test_data <- mutate(test_data,set=c(1,1,1,1,1,2,2,2,3,3,3,3,3,3,3,4,4,4,4))
set1 <- subset(test_data, set == 1)
set2 <- subset(test_data, set == 2)
set3 <- subset(test_data, set == 3)
set4 <- subset(test_data, set == 4)
But since my data set is huge, I am looking for a way to make subsets without typing each subset command. Is anyone experienced with that?