[R] R match - could be improved ?

Jeremy Clark jeremyclarkbio at gmail.com
Sun Mar 15 12:04:29 CET 2015

​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 =

myvector4[[1]] <- seq(95, 100, by = 0.01)

myvector5[[1]] <- match(myvector4[[1]], myvector3[[1]])


## A solution (but rather annoying):

myvector5[[1]] <- match(as.list(myvector4[[1]]), as.list(myvector3[[1]]))

Could anyone tell me why the NAs occur ??

Many thanks.​

	[[alternative HTML version deleted]]

More information about the R-help mailing list