R (R commander) - Sample -
i'm struggling sample function how can sample 50 samples dataset variable? in dataset, there 82 variables , dunno how sample 1 variable...;; wanna sample(randomly, without replacement) 50 samples variable @ r commander(or r)
plz help!
you can utilize either column index or column name. here's illustration samples 10 values first column of iris
info set. sec line shows sample beingness implemented 3 times.
sample(iris$sepal.length, 10l) ## or sample(iris[[1]], 10) # [1] 6.7 6.6 4.9 6.3 5.2 5.2 5.1 5.0 4.9 6.4 replicate(3l, sample(iris$sepal.length, 10l)) # [,1] [,2] [,3] # [1,] 5.1 5.6 5.6 # [2,] 6.9 5.0 5.1 # [3,] 4.4 6.9 6.5 # [4,] 7.2 5.8 5.5 # [5,] 5.7 7.7 6.7 # [6,] 4.8 5.0 5.0 # [7,] 5.0 6.2 5.8 # [8,] 5.9 5.6 6.0 # [9,] 4.9 4.9 6.1 # [10,] 5.6 6.1 7.2
r sample random-sample r-commander
No comments:
Post a Comment