I am doing this exercise and I can't find the error.
The data is a subsample of the New York taxi dataset (mht_lab2.zip
on Github).
In this current exercise I am supposed to tabulate short and long duration taxi trips against short/long distance taxi trips without using rxDataStep
. Therefore I did this:
mht_xdf <- RxXdfData('mht_lab2.xdf') # make sure the xdf-file is in your directory
rxCrossTabs(~dist_rule:dur_rule,mht_xdf,transformFunc = function(datalist){
datalist$dist_rule=as.factor(ifelse(datalist$trip_distance>5,'long','short'),levels=c('short','long'))
datalist$dur_rule=as.factor(ifelse(datalist$trip_duration>10,'long','short'),levels=c('short','long'))
return(datalist)},transformVars = c('trip_distance','trip_duration')
)
However it returns me an error:
Error in doTryCatch(return(expr), name, parentenv, handler) :
ERROR: The sample data set for the analysis has no variables.
I tried using the transformObjects
, the transforms
-argument and tried using combinations. It consistently returned an error.