[R] enquiry

Rui Barradas ruipbarradas at sapo.pt
Mon Oct 1 20:57:50 CEST 2012


Hello,

Or maybe %in%.

x <- Sys.Date() + 1:10
y <- Sys.Date() + 7:15

x %in% y # logical index into 'x'
x[x %in% y] # common
x[!x %in% y] # not common

setdiff(x, y) # doesn't keep class Date


Hope this helps,

Rui Barradas

Em 01-10-2012 15:57, R. Michael Weylandt escreveu:
> On Monday, October 1, 2012, Karan Anand wrote:
>
>> hi,
>>      I am new to using R ,I have 2 datasets with dates common in them ,how
>> can i take out the common dates within them.
>>
>>
> Depending on what you mean by 'out' either merge() or setdiff()
>
> RMW
>
>
>
>> karan
>>
>>          [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org <javascript:;> 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.
>>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.




More information about the R-help mailing list