2016-12-12 20 views
0

如果我運行此代碼:selction上XDF錯誤

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")))) 

它工作正常的我。

但是,如果我我的代碼更改爲:

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))) 

我得到這個錯誤:

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. 

你知道爲什麼我得到這個錯誤,我該如何解決呢?

+0

無關的問題,而是'XUFEFF'看起來像一個流氓[字節順序標記](HTTPS://en.wikipedia .ORG /維基/ Byte_order_mark)。你可能想修復它。 –

回答

1

原因是您的全局環境中您在rxDataStep中引用的任何對象都必須顯式聲明。 Microsoft R功能被設計爲可在分佈式環境中使用,因此您不能認爲所有進程都能夠訪問相同的全局對象。

通過transformObjects參數聲明你WarnungZeit對象,像這樣:

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))