essage-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Jennifer Sabatier
> Sent: Wednesday, August 01, 2012 7:18 AM
> To: David Winsemius
> Cc: r-help@r-project.org
> Subject: Re: [R] Help with NaN when 0 divided by 0
>
>
Hi Everyone,
Thanks so much for all your suggestions! All of these worked but David's
was best suited for my purposes, considering it was something happens
sporadically.
I don't do expenditure analyses often as I mostly do run of the mill survey
analysis, but this will come in handy for the once
On Jul 31, 2012, at 1:23 PM, Jennifer Sabatier wrote:
Hi All,
I have some data where I am doing fairly simple calculations,
nothing more
than adding, subtracting, multiplying and dividing.
Im running into a problem when I divide one variable by another and
when
theyre both 0 I get
Hi,
Here are two possible ways to deal with it. Which is better depends on
the larger context of your code. There's no right way, just whichever
is more convenient.
> ifelse(var2 != 0, var1/var2, 0)
[1] 0.0 13.9 53.79000 0.0 150.0 350.0
>
> newvar <- var1/var2
> newvar[i
On Jul 31, 2012, at 3:23 PM, Jennifer Sabatier
wrote:
> Hi All,
>
> I have some data where I am doing fairly simple calculations, nothing more
> than adding, subtracting, multiplying and dividing.
>
> I’m running into a problem when I divide one variable by another and when
> they’re both 0 I
Hi All,
I have some data where I am doing fairly simple calculations, nothing more
than adding, subtracting, multiplying and dividing.
Im running into a problem when I divide one variable by another and when
theyre both 0 I get NaN. I realize that if you divide a non-zero by 0 then
you get
6 matches
Mail list logo