It is a lot prettier than mine too.
Thanks Jari.
> rrarefy
function (x, sample)
{
if (length(sample) > 1 && length(sample) != nrow(x))
stop("length of 'sample' and number of rows of 'x' do not match")
sample <- rep(sample, length = nrow(x))
colnames(x) <- colnames(x, do.NULL
David Winsemius comcast.net> writes:
>
>
> On Feb 7, 2011, at 6:43 PM, B77S wrote:
>
> >
> > So, after thinking about this a bit, I realized that the previous
> > solution
> > wasn't exactly what I needed. I really needed replacement=F and to
> > be able
> > to choose any sample size (n.s
On Feb 7, 2011, at 6:43 PM, B77S wrote:
So, after thinking about this a bit, I realized that the previous
solution
wasn't exactly what I needed. I really needed replacement=F and to
be able
to choose any sample size (n.sample) less than or equal to the site
(row)
with the lowest total
So, after thinking about this a bit, I realized that the previous solution
wasn't exactly what I needed. I really needed replacement=F and to be able
to choose any sample size (n.sample) less than or equal to the site (row)
with the lowest total abundance.
Anyway, I think this works. Forgiv
set.seed "sets" the (pseudo-)random number generator in a predictable
state so that you get the same table as I do when running the code,
assuming you don't do any other calls to the RNG in the interim.
123 is kind of traditional as a seed for demonstration purposes, but
in real analyses yo
Also, I really appreciate you explaining why you used factor. I'm still not
quite sure what set.seed does (i read ?set.seed) or why you chose 123... but
it and the function below work, so that is all that matters. :)
randSub <- function(L1, s.size)
{
set.seed(123)
samptbl <- apply(L1, 1, fun
hehe...
very true sir; I apologize, that was very straightforward. Thank you for
your time.
--
View this message in context:
http://r.789695.n4.nabble.com/Subsampling-out-of-site-abundance-matrix-tp3263148p3263598.html
Sent from the R help mailing list archive at Nabble.com.
___
On Feb 6, 2011, at 9:35 PM, B77S wrote:
I figured there would be an even more straightforward way, but that
works
David, thanks.
I am rather puzzled. What prior experience with computing would lead
you to believe that one line of code was not a straightforward method
to do multinomial
I figured there would be an even more straightforward way, but that works
David, thanks.
There has to be a way to get the output I want/need (see below). I tried to
bind or merge the elements of "apply(samptbl, 2, table)" but with no
success. I could probably make a for loop with a merge stat
On Feb 6, 2011, at 3:25 PM, B77S wrote:
Hello,
How can I randomly sample individuals within a sites from a site
(row) X
species abundance (column) data frame or matrix? As an example, the
matrix
"abund2" made below.
# (sorry, Im a newbie and this is the only way I know to get an
e
Hello,
How can I randomly sample individuals within a sites from a site (row) X
species abundance (column) data frame or matrix? As an example, the matrix
"abund2" made below.
# (sorry, Im a newbie and this is the only way I know to get an example
on here)
abund1 <-c(150, 300, 0, 36
11 matches
Mail list logo