timestamp(prefix="starting job at ",suffix=".\n")
for (split in
c(
"srw_aa","srw_ab","srw_ac","srw_ad","srw_ae","srw_af","srw_ag","srw_ah",
"srw_ai","srw_aj","srw_ak","srw_al","srw_am","srw_an","srw_ao","srw_ap",
"srw_aq","srw_ar","srw_as","srw_at","srw_au","srw_av","srw_aw","srw_ax",
"srw_ay","srw_az","srw_ba","srw_bb","srw_bc","srw_bd","srw_be","srw_bf",
"srw_bg","srw_bh","srw_bi","srw_bj","srw_bk","srw_bl","srw_bm","srw_bn",
"srw_bo","srw_bp","srw_bq","srw_br","srw_bs","srw_bt","srw_bu","srw_bv",
"srw_bw","srw_bx","srw_by","srw_bz","srw_ca","srw_cb","srw_cc","srw_cd",
"srw_ce","srw_cf"
)
)
{
cat("reading ", split, "...")
##uncomment the second to use the older CSV-based import. This is slower. And much less cool.
load(paste("c:/r_scratch/srw_split_bin/",split,sep=""))
##srw <- read.csv2(paste("c:/r_scratch/srw_split_bin/",split,sep=""),col.names=c("deal_id", "srw", "old_srw", "form"),comment.char="",sep=",")
##Names are already set by the above functions, but do it again anyways for redundancy. It's only a second or two of time.
names(srw)<-c("deal_id","srw","old_srw","deal_id")
cat(" done.\naggregating...")
##this_srw <- sqldf("select a.new_srw, b.COUNTRY_ID, sum(b.LEADS), sum(b.SALES) from srw a, deals_intl b where a.DEAL_ID = b.DEAL_ID group by a.new_srw, b.COUNTRY_ID") ##Outdated with PLYR's join() function. Hooray for native C code!'
final<-rbind(final, join(impr_cts_cs_plus, srw, by="deal_id", type="inner"))
cat("done. finished processing.", length(final[,1]), "rows have now been processed.\n")
}
cat("Job ended at ", timestamp(prefix="",suffix=""))