Displaying 1 result from an estimated 1 matches for "nbrofsamples".
2003 Oct 27
2
how to select random rows ?
How can I select random subsets (rows!) from a data set ?
If I generate simple data set
> a <- data.frame(x=1:2, y = NaN, z = 2:1)
> a
x y z
1 1 NaN 2
2 2 NaN 1
I can select random subsets (colums) very easily using sample function:
> sample(a, 2)
z y
1 2 NaN
2 1 NaN
I expected that using transpose of a would do the same for rows, but I am
getting
rather unexpected