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加载的表中的列。谢谢!