Use %in% instead of '==' On Mon, Oct 18, 2010 at 10:50 AM, Paolo Agnolucci < agnolucp...@googlemail.com> wrote:
> Hi all, > > I am not exactly fluent in R and I got stuck with this. I would like to > compare each elements of a vector A with any of the elements in Vector B. > For some reasons it does not work. > > > StartDate = as.Date("01/10/2007", "%d/%m/%Y") > > TimeSpan = seq(StartDate, by = 'days', length = > length(myAverageCWVs$X1986)) > > > TickLabels = c("2007-10-01", "2007-11-01", "2007-12-01", "2008-01-01") > > > TimeSpan[1:40] == TickLabels > Here I would expect TRUE for teh first entry and then TRUE for the entry > related to "2007-11-01". This doesn't seem to be the case. > > [1] TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE > [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE > [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE > FALSE > [37] FALSE FALSE FALSE FALSE > > > Thanks you in advance for any help. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list 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.