selction on xdf error

1k views Asked by At

If I run this code:

myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
    rowSelection=floor(as.numeric(X.U.FEFF.time)) ==
                     floor(as.numeric(as.POSIXct("2016-08-29 19:16:10",tz="GMT"))))

It works fine for me.

But if I change my code to:

WarnungZeit <- as.POSIXct("2016-08-29 19:16:10",tz="GMT")
WarnungZeit <- WarnungZeit + Test1[1,]$Diff_Warnung

myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
    rowSelection=floor(as.numeric(X.U.FEFF.time)) ==
                     floor(as.numeric(WarnungZeit)))

I get this error:

ERROR: The sample data set for the analysis has no variables.
Caught exception in file: CxAnalysis.cpp, line: 3756. ThreadID: 4872 Rethrowing.
Caught exception in file: CxAnalysis.cpp, line: 5249. ThreadID: 4872 Rethrowing.
Error in doTryCatch(return(expr), name, parentenv, handler) : 
  ERROR: The sample data set for the analysis has no variables.

Do you know why I get this error and how can I solve it?

1

There are 1 answers

0
Hong Ooi On BEST ANSWER

The reason is that any objects in your global environment that you reference in a rxDataStep have to be explicitly declared. Microsoft R functions are designed to be usable in a distributed environment, so you can't assume that all processes will be able to access the same global objects.

Declare your WarnungZeit object via the transformObjects argument, like so:

myData <- rxDataStep(inData=SensorData, varsToKeep=c("X.U.FEFF.time"),
    rowSelection=floor(as.numeric(X.U.FEFF.time)) == floor(as.numeric(wz)),
    transformObjects=list(wz=WarnungZeit))