I'm using node.js to spawn R process to do some calculation, the spawning process code is almost the same as shiny-server:
proc = child_process.spawn(program, args, {
stdio: ['pipe', 'pipe', logStream],
cwd: appSpec.appDir,
env: map.compact({
'HOME' : process.env['USERPROFILE'],
'LANG' : process.env['LANG'],
'PATH' : process.env['PATH']
}),
detached: (process.platform == 'win32') ? false : true
});
Since shiny-server uses posix functions, and doesn't support windows for now, I used process.env['USERPROFILE'] as home option, and true for detached option on windows
In this way, R process can be spawned and do the calculation. But, the spawned R process always looks at system library when loading packages, while there's both user and system library path.
> .libPaths()
[1] "C:/Users/xxx/Documents/R/win-library/3.3" "C:/Program Files/R/R-3.3.2/library"
I would like the spawned R process to load package from user lib path instead of system lib path
How can I do that? Thanks!
via jerry
No comments:
Post a Comment