[R] weird error message
Gabor Grothendieck
ggrothendieck at gmail.com
Sat Jul 1 01:20:28 CEST 2006
This is FAQ 7.31:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
Also please do not piggy back on other threads since it makes the
archives less useful.
On 6/30/06, Alexander Nervedi <alexnerdy at hotmail.com> wrote:
> Hi!
>
> In the example below why is x[[1]] == 0.2237724 false?
>
> Alexander Nervedi
>
>
> >x <- runif(10)
> >x[[1]]
> [1] 0.2237724
>
> >x
> [1] 0.2237724 0.2678944 0.9375811 0.5963889 0.6180519 0.6449580 0.7308510
> [8] 0.7347386 0.4837286 0.1416100
>
> >x[[1]] == 0.2237724
> FALSE
>
>
>
>
>
>
> >From: "Alexander Nervedi" <alexnerdy at hotmail.com>
> >To: r-help at stat.math.ethz.ch
> >Subject: Re: [R] Creating Vectors
> >Date: Fri, 30 Jun 2006 21:57:35 +0000
> >
> >Hi all.
> >
> >I have a factor variable distributed over time. I am looking for an elegant
> >way to code duration of a state. Suppose,
> >
> > >rainfall.shocks <- factor(sample(c(1,2,3), size = 15, replace = TRUE,
> >prob
> > >= unit.p),
> >+ label = c("Drought", "Normal", "High"))
> > >
> > >rainfall.shocks
> >[1] Normal High High Drought Normal Normal High Normal Drought
> >[10] Normal Drought Normal Normal Normal Normal
> >
> >
> >So capture the duration of say drought, I'd need a variable that is able to
> >keep track of rainfall.shocks as well as its past values. I was wondering
> >if
> >there is any obvious way to do this. the Drought variable in this case
> >would
> >have values
> >
> >0 0 0 1 0 0 0 0 1 0 1 0 0 0 0
> >
> >many thanks for the suggestions you are likely to make.
> >
> >Alexander Nervedi
> >
> >______________________________________________
> >R-help at stat.math.ethz.ch mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide!
> >http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list