Re: [R] data and parameters

2011-01-24 Thread analys...@hotmail.com
Thanks. I finally got around to implementing it and it works. But I think the steps to produce master_reduced can be compressed into master_reduced = merge(master,control) > master clientId date value 11 1001 10001 22 1002 10002 33 1003 10003 44 1004 10004 5

Re: [R] data and parameters

2011-01-21 Thread jim holtman
forgot the control parameters: > sqldf(" + select m.*, c.control_params + from master m, control c + where m.clientId = c.clientID + and m.date between c.mindate and c.maxdate + ") clientId date value control_params 12 1002 10002 1 2

Re: [R] data and parameters

2011-01-21 Thread jim holtman
try 'sqldf' > master=as.data.frame(list(clientId=c(1:4,2), date=1001:1005, + value=10001:10005)) > control=as.data.frame(list(clientId=c(2,3), mindate=c(100,1005), + maxdate=c(1005,1005), control.params=c(1,2))) > master clientId date value 11 1001 10001 22 1002 10002 33

Re: [R] data and parameters

2011-01-21 Thread Moritz Grenke
#dummy data: master=as.data.frame(list(clientId=c(1:4,2), date=1001:1005, value=10001:10005)) control=as.data.frame(list(clientId=c(2,3), mindate=c(100,1005), maxdate=c(1005,1005), control.params=c(1,2))) #reducing master df: #generating "TRUE FALSE index": idIndex=master$clientId %in% control$cli