I have a question on how to sample
I have a dataframe called 'inventory' that looks like this (1000 rows)
inventory_date number_purchases
1 1/1/1986 20
2 2/4/1992 15
3 12/13/2001 10
I want to sample 5 of the rows
This is my code
samplesize <- c(5,10,15,20,25)
for (m in 1:length(samplesize))
{
mysample <- sample(inventory, samplesize[m], replace=FALSE)
}
When I run the code, it takes 1000 not a sample of 5, 10, 15, etc. It is ignoring samplesize[m] Why? What is wrong with my code?
It seems straightforward.