Dear list, (this is a follow up from a previous query) Why does R CMD INSTALL write most of its messages to stderr? If it wrote to stdout, then we could capture its output within an R session when calling sink("stdout.txt", type="output") install.packages("MASS", type="source") sink()
As it stands, the stderr messages can't be captured via sink/capture.output/suppressMessages within an R session. Interestingly, the make output goes to stdout, but the R messages go to stderr: # the 'make' output goes to stdout $ R --vanilla CMD INSTALL -l /tmp MASS_7.3-14.tar.gz 2>/dev/null gcc-4.2 -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c MASS.c -o MASS.o gcc-4.2 -arch i386 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/i386 -I/usr/local/include -fPIC -g -O2 -c lqs.c -o lqs.o gcc-4.2 -arch i386 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o MASS.so MASS.o lqs.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c MASS.c -o MASS.o gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include/x86_64 -I/usr/local/include -fPIC -g -O2 -c lqs.c -o lqs.o gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o MASS.so MASS.o lqs.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation # the R CMD INSTALL output goes to stderr $ R --vanilla CMD INSTALL -l /tmp MASS_7.3-14.tar.gz >/dev/null * installing *source* package MASS ... ** libs *** arch - i386 installing to /private/tmp/MASS/libs/i386 *** arch - x86_64 installing to /private/tmp/MASS/libs/x86_64 ** R ** data ** moving datasets to lazyload DB ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ... ** testing if installed package can be loaded * DONE (MASS) $ R --vanilla CMD INSTALL -l /tmp MASS_7.3-14.tar.gz &>/dev/null # no output Why do I care? i'm writing some software which uses R behind the scenes, and would like to suppress the messages that are produced by install.packages() when R libraries are being installed. So, will it be possible for R CMD INSTALL output be written to stdout in the future? kind regards, Mark ----------------------------------------------------- Mark Cowley, PhD Pancreatic Cancer Program | Peter Wills Bioinformatics Centre Garvan Institute of Medical Research, Sydney, Australia ----------------------------------------------------- sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] en_AU.UTF-8/en_AU.UTF-8/C/C/en_AU.UTF-8/en_AU.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base [[alternative HTML version deleted]]
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel