Re: [R] rbinom for a matrix

2008-07-10 Thread Ben Bolker
ACroske yahoo.com> writes: > > > Ben: > Thanks for the reply. One further question, and this is where my novice > status at R shows through. The code makes sense, but what would I put it for > "m"? Is it the same number for all three (that was my first thought since it > was the same placeholde

Re: [R] rbinom for a matrix

2008-07-09 Thread ACroske
Yes I do want a random assignment, instead of rounding. (From what I understand of the rbinom command, it will randomly assign 1 or 0, and the higher the given probability, the higher the likelihood of a 1... Feel free to correct me if I'm wrong!) Ben Bolker wrote: > > -BEGIN PGP SIGNED ME

Re: [R] rbinom for a matrix

2008-07-09 Thread ACroske
Ben: Thanks for the reply. One further question, and this is where my novice status at R shows through. The code makes sense, but what would I put it for "m"? Is it the same number for all three (that was my first thought since it was the same placeholder for all three). Number of rows in the matr

Re: [R] rbinom for a matrix

2008-07-09 Thread Dylan Beaudette
On Wednesday 09 July 2008, Ben Bolker wrote: > Dylan Beaudette wrote: > | On Wednesday 09 July 2008, Ben Bolker wrote: > |> ACroske yahoo.com> writes: > |>> I have a large matrix full of probabilities; I would like to convert > > each > > |>> probability to a 1 or a 0 using rbinom. > |>> How can I

Re: [R] rbinom for a matrix

2008-07-09 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dylan Beaudette wrote: | On Wednesday 09 July 2008, Ben Bolker wrote: |> ACroske yahoo.com> writes: |>> I have a large matrix full of probabilities; I would like to convert each |>> probability to a 1 or a 0 using rbinom. |>> How can I do this on the

Re: [R] rbinom for a matrix

2008-07-09 Thread Dylan Beaudette
On Wednesday 09 July 2008, Ben Bolker wrote: > ACroske yahoo.com> writes: > > I have a large matrix full of probabilities; I would like to convert each > > probability to a 1 or a 0 using rbinom. > > How can I do this on the entire matrix? The matrix was converted from a > > raster ArcMap dataset,

Re: [R] rbinom for a matrix

2008-07-09 Thread Erik Iverson
Is this what you're looking for? test <- matrix(runif(100, 0, 1), nrow = 20) nr <- nrow(test) matrix(sapply(test, rbinom, n = 1, size = 1), nrow = nr) ACroske wrote: I have a large matrix full of probabilities; I would like to convert each probability to a 1 or a 0 using rbinom. How can I do th

Re: [R] rbinom for a matrix

2008-07-09 Thread Ben Bolker
ACroske yahoo.com> writes: > > > I have a large matrix full of probabilities; I would like to convert each > probability to a 1 or a 0 using rbinom. > How can I do this on the entire matrix? The matrix was converted from a > raster ArcMap dataset, so the matrix is essentially a map. Because of

[R] rbinom for a matrix

2008-07-09 Thread ACroske
I have a large matrix full of probabilities; I would like to convert each probability to a 1 or a 0 using rbinom. How can I do this on the entire matrix? The matrix was converted from a raster ArcMap dataset, so the matrix is essentially a map. Because of this, I have no column headings. Thanks!