Created attachment 1791 [details]
sample showing the problem, requires testthat, but can be easily altered
system2() does not set environment variables properly (at least, other not tested) on Windows OS. While documentation is somewhat vague regarding *env* argument. I tried named character vector and just a character vector with name=value pairs with same result. Using Sys.setenv() works as expected. Sample R script is attached.
I failed to mention the R version as there was no such in a drop down box.
system i386, mingw32
svn rev 67962
version.string R version 3.1.3 (2015-03-09)
nickname Smooth Sidewalk
Apparently I missed the note in docs mentioning the limitation on Windows. So I change this to "enhancement". It would be handy, e.g. to run python scripts with non-standard installations requiring setting PYTHONHOME, PATH and such.