Sql Server 2016 RevoScaleR错误$操作符未为此S4类定义

时间:2015-12-23 19:35:31

标签: sql-server r revolution-r sql-server-2016

connectionString <- "Driver=SQL Server;Server=xxx;Database=TestDB;Uid=test;Pwd=test"`
    SampleDataTable <- "SampleData"
    sqlRowsPerRead = 5000 

     sampleDataDS <- RxSqlServerData(
     connectionString = connectionString,
     table = SampleDataTable,
     rowsPerRead = sqlRowsPerRead)

     # Read the variable information
     varInfo <- rxGetVarInfo( data = sampleDataDS )

     # Print the variable information
     varInfo
     sqlShareDir <- paste("c:\\AllShare\\", Sys.getenv("USERNAME"), sep="")
     dir.create(sqlShareDir, recursive = TRUE)
     sqlWait <- TRUE
     sqlConsoleOutput <- FALSE

定义计算上下文

        rxSetComputeContext(
          RxInSqlServer(
                connectionString = connectionString,
                 shareDir = sqlShareDir,
                 wait = sqlWait,
                 consoleOutput = sqlConsoleOutput,
                 traceEnabled = TRUE,
                 traceLevel = 7)
        ) 

rxGetVarInfo(data = sampleDataDS)

错误:

inTraining <-createDataPartition(c(sampleDataDS$column1,sampleDataDS$column2, p = 0.75, list = FALSE)

“createDataPartition命令会抛出错误, sampleDataDS $ column1中的错误:   没有为此S4类定义$运算符“

有人可以帮我解决这个错误吗?我不知道如何访问我从SQL Server加载的表中的列。谢谢!

0 个答案:

没有答案