1

So I have a data frame with several columns and I want to create another data frame that is basically a small sample of the first. I want the size of it to be 10% of the original data frame's size. I tried this:

sample(df,length(df$column1)*0.1)

but it returns an error:

Error in sample.int(length(x), size, replace, prob) : cannot take a sample larger than the population when 'replace = FALSE'

Thank you in advance for any suggestion

Bappa Das
  • 5,817
  • 3
  • 18
  • 40
tadeufontes
  • 437
  • 3
  • 9

0 Answers0