Re: [R] calculate within-day correlations

2012-09-15 Thread Joshua Ulrich
On Fri, Sep 14, 2012 at 6:14 PM, emorway wrote: > Hi Joshua, > > I was attempting to work with your code on the larger datasets, which I have > to read in with 'read.table', but I've apparently missed something. When I > attempt to massage the data.frame a bit in the code below, as.POSIXct drops

Re: [R] calculate within-day correlations

2012-09-14 Thread emorway
Hi Joshua, I was attempting to work with your code on the larger datasets, which I have to read in with 'read.table', but I've apparently missed something. When I attempt to massage the data.frame a bit in the code below, as.POSIXct drops the time component which then precludes use of xts. I t

Re: [R] calculate within-day correlations

2012-09-13 Thread David Winsemius
On Sep 13, 2012, at 7:09 PM, Rui Barradas wrote: > Hello, > > Try the following. > > Q_use_2 <- split(Q_use, as.Date(Q_use$date)) > SC_use_2 <- split(SC_use, as.Date(SC_use$date)) > > lapply(seq_along(Q_use_2), function(i) cor(Q_use_2[[i]]$Q, SC_use_2[[i]]$SC)) Probably will get better result

Re: [R] calculate within-day correlations

2012-09-13 Thread Rui Barradas
Hello, Try the following. Q_use_2 <- split(Q_use, as.Date(Q_use$date)) SC_use_2 <- split(SC_use, as.Date(SC_use$date)) lapply(seq_along(Q_use_2), function(i) cor(Q_use_2[[i]]$Q, SC_use_2[[i]]$SC)) Hope this helps, Rui Barradas Em 14-09-2012 01:35, emorway escreveu: useRs, Here is some R-

Re: [R] calculate within-day correlations

2012-09-13 Thread Joshua Ulrich
On Thu, Sep 13, 2012 at 7:35 PM, emorway wrote: > useRs, > > Here is some R-ready data for my question to follow. Of course this data is > small snippet from a much larger dataset that is about a decade long. > > > Q_use<-data.frame(date=as.POSIXct(paste(Q[,1],"-",Q[,2],"-",Q[,3]," > ",floor(Q[,

[R] calculate within-day correlations

2012-09-13 Thread emorway
useRs, Here is some R-ready data for my question to follow. Of course this data is small snippet from a much larger dataset that is about a decade long. Q<-read.table(textConnection("2002 3 28 15 77.38815 2002 3 28 30 77.09505 2002 3 28 45 76.80196 2002 3 28 60 7