[R] Sampling problems

Oritteropus lucasantini85 at hotmail.com
Thu Mar 8 11:16:48 CET 2012


Thanks, but it doesn't work either, it gives me the same message error. 
It works just if my first sample is taken in this way:

mysample <- sample(1:nrow(MeanA), 20, replace=FALSE)

However, in this way it sample just the number of rows:
 [1] 71 24 12 36  2 39 69 62 43 38  9 44 13 54 50 63 67 66 37 28

but not the data inside.  I need to sample in this way:

mysample <- MeanA[sample(1:nrow(MeanA), 20, replace=FALSE),] 

to get a sample like this

HRkm        Mean.mf         Mean.mfm         Loc         Diet         Terr
Soc         Type         Soc.Ter         W.cat.0.25         W.cat.0.5
-2.49                -0.43                2.57                       A           
O                T                       S                   D                     
TS                          b        
23                     -2.05                0.67                       T           
C                N                       S                    D                     
NS                       A

This is an example of my dataframe

--
View this message in context: http://r.789695.n4.nabble.com/Sampling-problems-tp4453752p4456048.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list