[R] merging data sets to match data to date

Henrique Dallazuanna wwwhsd at gmail.com
Wed Aug 13 15:11:06 CEST 2008


Try this:

x <- data.frame(Dates = seq(as.Date('2008-01-01'),
                                          as.Date('2008-01-31'), by = 'days'),
                       Values = sample(31))

subset(x, Dates %in% as.Date(c('2008-01-05', '2008-01-20')))

On 8/13/08, rcoder <mpdotbook at gmail.com> wrote:
>
> Hi everyone,
>
> I want to extract data from a data set according to dates specified in a
> vector. I have created a blank matrix with row names (dates) that I want to
> extract from the full data set. I have then performed a merge to try to o/p
> rows corresponding to common dates to a results matrix, but the operation
> did not fill the results matrix. Coulc anyone offer any advice to assist
> with this operation?
>
> Thanks,
>
> rcoder
> --
> View this message in context: http://www.nabble.com/merging-data-sets-to-match-data-to-date-tp18962197p18962197.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>


-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list