For is taking the rest of the sample variables in R

Asked

Viewed 37 times

1

I’m making a sample and the size of it is in a spreadsheet called "sizing". When I use the command is, as below, the sample is made, however, appears only the first column for each sample, I would like to appear the entire database for each sample.

bons1<-0
for(i in 2:14){
bons1[i]<-subset(bons,data==tamamostra[1,i]) 
[sample(nrow(subset(bons,data==tamamostra[1,i])), tamamostra[3,i]), ]
}

When I do it without it, 1 to 1, the command works perfectly. Where can I be missing? Also, some warnings like:

number of items to replace is not a multiple of replacement length
  • 1

    Probably the error occurs because you are trying to store multiple values in a vector. But it is hard to say without a sampled your data. What are the data in size? What is the good object? Provide an example that can be replicated.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.