This list is a plain text list. Posting in HTML frequently leads to corrupted 
code on the receiving end. Be sure to read the Posting Guide.

In no programming language is it a good idea to assume equality with floating 
point values. See FAQ 7.31. In cases like this use integers to create sequences 
and then generate floating point from them. Do not go fishing in floating point 
data for specific values.

Also, you seem to be using list objects for no apparent reason.

myvector1 <- c(1L:100L)

myvector3 <- seq(10L*myvector1[1], 10L*myvector1[ length(myvector1) ])

myvector4 <- seq(950L, 1000L)

myvector5 <- match(myvector4, myvector3)

I think the as.list is working because match is internally converting to 
character and comparing that... which makes the as.list solution rather 
inefficient art best.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On March 15, 2015 4:04:29 AM PDT, Jeremy Clark <jeremyclark...@gmail.com> wrote:
>​Dear All,
>
>The following gives a very unpleasant experience with apparently random
>NAs
>- probably it's my bad formatting of the coding - but the effect is
>unexpected and if undetected can lead to considerable problems:
>
>myvector1 = NULL
>
>myvector3 = NULL
>
>myvector4 = NULL
>
>myvector5 = NULL
>
>
>
>myvector1 <- c(1:100)
>
>
>
>
>
>myvector3[[1]] <- seq(myvector1[1], myvector1["length"(myvector1)], by
>=
>0.01)
>
>myvector4[[1]] <- seq(95, 100, by = 0.01)
>
>
>
>myvector5[[1]] <- match(myvector4[[1]], myvector3[[1]])
>
>
>
>myvector5
>
>
>
>## A solution (but rather annoying):
>
>
>
>myvector5[[1]] <- match(as.list(myvector4[[1]]),
>as.list(myvector3[[1]]))
>
>myvector5
>​
>Could anyone tell me why the NAs occur ??
>
>Many thanks.​
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to