[R-pkg-devel] Writing a portable package that imports functions only available on Windows

Richard Cotton richierocks at gmail.com
Sat Sep 19 12:07:06 CEST 2015

I have a package that uses win.version from the utils package.

I've made my R code safe to use across platforms, I check that the OS is
Windows before calling win.version.

The NAMESPACE file contains the line


which causes an install failure under other OSes since that function
doesn't exist.

Can I use this platform-dependent function and still have a cross-platform

Also, it seems like it would be nicer if the utils package always included
this function and returned NA with a warning on platforms other than
Windows.  Does that sound like a reasonable change?


Learning R <http://shop.oreilly.com/product/0636920028352.do>

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list