# Load data house.df <- read.csv("WestRoxbury.csv") # Extract the row numbers house.rows <- row.names(house.df) # Partition the row numbers into 10 equal subsets set.seed(100) house.rows.list <- list() for(i in 1:10){ house.rows.list[[i]] <- sample(house.rows, length(house.rows) / (10 - i + 1)) house.rows <- setdiff(house.rows, house.rows.list[[i]]) } # Partition the data into 10 equal subsets house.df.list <- list() for(i in 1:10){ house.df.list[[i]] <- house.df[house.rows.list[[i]],] } # Display the number of observations in each subset for(i in 1:10){ print(paste("Number of observations in subset", i, "=", dim(house.df.list[[i]])[1])) }