This function builds on sample
to provide sampling from a vector, but with all
zero entries fixed. This way, zfsample(c(0,1,0,2))
may result in (0,1,0,2) or (0,2,0,1), but the
positions that were initially zero will remain zeroed.
1 |
x |
Either a vector of one or more elements from which to choose, or a positive integer. |
replace |
Should sampling be with replacement? |
a vector of the same length of 'x' with elements drawn from 'x'.
The actual sampling is done by sample
, so its help page should be checked
for details on the parameter handling. The parameter 'size' is always passed as length(x)
,
and 'prob' is not supported.
1 2 3 4 5 6 7 8 |
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.