FAQ 7.31 I think. Here are a couple things you can try. close_enough <- function(x, y) isTRUE(all.equal(x, y))
periodlimint<-seq(from=0.1, to=50, by=0.1) indexAtest <- which(sapply(periodlimint, close_enough, y = 0.7)) match( as.character(.7), periodlimint) Best, Ista On Wed, Mar 30, 2016 at 1:35 AM, Rubel Das via R-help <r-help@r-project.org> wrote: > Dear R group memberI tried couple of hours to figure out the solution of > following.match function behaves strange from value 0.7 and 1.7 > >> periodlimint<-seq(from=0.1, to=50, by=0.1)> indexAtest<-match( .6, >> periodlimint)> indexAtest[1] 6> periodlimint<-seq(from=0.1, to=50, by=0.1)> >> indexAtest<-match( .7, periodlimint)> indexAtest[1] NA> >> periodlimint<-seq(from=0.1, to=50, by=0.1)> indexAtest<-match( .8, >> periodlimint)> indexAtest[1] 8> periodlimint<-seq(from=0.1, to=50, by=0.1)> >> indexAtest<-match( 1.7, periodlimint)> indexAtest[1] NA > it will be helpful if you provide your comment > RegardsRubel > > [[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.