[R] sampling rows with values never sampled before
C W
tmrsg11 at gmail.com
Mon Jun 22 18:42:52 CEST 2015
Hello R list,
I am have question about sampling unique coordinate values.
Here's how my data looks like
> dat <- cbind(x1 = rep(1:5, 3), x2 = rep(c(3.7, 2.9, 5.2), each=5))
> dat
x1 x2
[1,] 1 3.7
[2,] 2 3.7
[3,] 3 3.7
[4,] 4 3.7
[5,] 5 3.7
[6,] 1 2.9
[7,] 2 2.9
[8,] 3 2.9
[9,] 4 2.9
[10,] 5 2.9
[11,] 1 5.2
[12,] 2 5.2
[13,] 3 5.2
[14,] 4 5.2
[15,] 5 5.2
If I sampled (1, 3.7), then, I don't want (1, 2.9) or (2, 3.7).
I want to avoid either the first or second coordinate repeated. It leads
to undefined matrix inversion.
I thought of using sampling(), but not sure about applying it to a data
frame.
Thanks in advance,
Mike
[[alternative HTML version deleted]]
More information about the R-help
mailing list