Message("Retrieved: ", table_out, " - ", paste(colnames(get(table_out)), collapse=", ")) System2(prog, args=c("-e", shQuote(expr)), stdout=NULL, wait=TRUE, invisible=TRUE) # launch 32 bit R session and run the expression we built # build expression to pass to 32 bit R sessionĮxpr <- c(expr, sprintf("%s <- odbcDriverConnect('%s')", ODBC_con, ODBC_str))Įxpr <- c(expr, sprintf("%1$s <- sqlQuery(%3$s, \"%2$s\")", table_out, db_sql, ODBC_con))Įxpr <- c(expr, sprintf("%s <- socketConnection(port=%i)", sock_con, sock_port))Įxpr <- c(expr, sprintf("evalServer(%s, %s, %s)", sock_con, table_out, table_out))Įxpr <- c(expr, sprintf("close(%s)", sock_con)) StartSocketServer(port=sock_port, server.name="access_query_32", local=TRUE) # start socket server to transfer data to 32 bit session access_query_32 <- function(db_table = "qryData_RM", table_out = "data_access") " One thing to note is that the socket server saves the access data in the global environment so the second parameter is used to define the output instead of using "<-" to save the output. The function builds an expression string that is passed to a second 32 bit session data is then returned to the original session using socket server package (svSocket). Here is a single function that will transfer data from 32 bit access to 64 bit R without having to save any files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |