search for: rt_date

Displaying 4 results from an estimated 4 matches for "rt_date".

Did you mean: st_date
2012 Mar 02
3
speed up merge
Hello, I have a nasty loop that I have to do 11877 times. The only thing that slows it down really is this merge: xx1 = merge(dt,ua_rd,by.x=1,by.y= 'rt_date',all.x=T) Any ideas on how to speed it up? The output can't change materially (it works), but I'd like it to go faster. I'm looking at getting around the loop (not shown), but I'm trying to speed up the merge first. I'll post regarding the loop if nothing comes of this post...
2012 Mar 05
1
index instead of loop?
...= as.Date("2009-03-25"), by = "day") dt = sapply(dt1, as.character) fin = dt ck_rows = length(dt) bad = character(0) start_t_all = Sys.time() for(cn in 1:ncol(ua)){ uac = ua[,cn] tkr = colnames(ua)[cn] rdc = rd[,cn] ua_rd = cbind(uac,rdc) colnames(ua_rd) = c(tkr,'rt_date') xx1 = merge(dt,ua_rd,by.x=1,by.y= 'rt_date',all.x=T) xx = as.character(xx1[,2]) values <- c(NA, xx[!is.na(xx)]) ind = cumsum(!is.na(xx)) + 1 y <- values[ind] if(ck_rows == length(y)){ fin = data.frame(fin,y) }else{ bad = c(bad,tkr) } } colnames(fin) = c...
2012 Mar 01
1
fill data forward in data frame.
...03-31 2010-06-30 2010-09-30 2010-12-31 2011-03-31 2011-06-30 2011-09-30 2011-12-31 12649.00 13039.00 13425.00 13731.00 14014.00 14389.00 14833.00 15095.00 15481.43 15846.43 16186.43 > x = merge(ua,rd,by='row.names') > names(x) = c('z.date','val','rt_date') > xx = merge(dt,x,by.y= 'rt_date',by.x=1,all.x=T) > xx x z.date val 1 2009-06-01 <NA> NA 2 2009-06-02 <NA> NA 3 2009-06-03 <NA> NA 4 2009-06-04 <NA> NA 5 2009-06-05 <NA>...
2012 Mar 03
0
removing data look-ahead, something faster.
...= as.Date("2009-03-25"), by = "day") dt = sapply(dt1, as.character) fin = dt ck_rows = length(dt) bad = character(0) start_t_all = Sys.time() for(cn in 1:ncol(ua)){ uac = ua[,cn] tkr = colnames(ua)[cn] rdc = rd[,cn] ua_rd = cbind(uac,rdc) colnames(ua_rd) = c(tkr,'rt_date') xx1 = merge(dt,ua_rd,by.x=1,by.y= 'rt_date',all.x=T) xx = as.character(xx1[,2]) values <- c(NA, xx[!is.na(xx)]) ind = cumsum(!is.na(xx)) + 1 y <- values[ind] if(ck_rows == length(y)){ fin = data.frame(fin,y) }else{ bad = c(bad,tkr) } } colnames(fin) = c...