반응형

출처: https://stat.ethz.ch/pipermail/r-help/2007-February/125860.html



> iris[sample(nrow(iris), 2), ]
   Sepal.Length Sepal.Width Petal.Length Petal.Width    Species
96          5.7         3.0          4.2         1.2 versicolor
17          5.4         3.9          1.3         0.4     setosa



# Select 5 random rows

> iris[sample(nrow(iris), 5), ]
   Sepal.Length Sepal.Width Petal.Length Petal.Width    Species
83          5.8         2.7          3.9         1.2 versicolor
12          4.8         3.4          1.6         0.2     setosa
63          6.0         2.2          4.0         1.0 versicolor
80          5.7         2.6          3.5         1.0 versicolor
49          5.3         3.7          1.5         0.2     setosa





반응형

+ Recent posts