[R] as.integer question
Erin Hodgess
erinm.hodgess at gmail.com
Thu Jan 17 18:35:34 CET 2008
Hi R People:
I'm reading "Statistical Computing with R", by Maria Rizzo, and it's
really good.
Anyhow, I have a question about something in there.
> u <- runif(5)
> u
[1] 0.1177041 0.4271790 0.4601597 0.2204846 0.4051473
> #in the book
> sum(as.integer(u > 0.4))
[1] 3
> #what I would do
> sum(u > 0.4)
[1] 3
>
Is one way better than the other, please?
Thanks,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
More information about the R-help
mailing list