Finished coding of generic CV

Also fixed a bug: sampled data is a db.data.frame, must converted to
db.Rquery before expanding to dummy variables