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

UseR10085
  • 7,120
  • 3
  • 24
  • 54
tadeufontes
  • 443
  • 1
  • 3
  • 12

0 Answers0