22  R version

22.0.1 Rversion.h

Used test current version of R

22.0.2 R_Version(), R_VERSION()

Header: Rversion.h
R equivalent: R.version

Test the compile-time version of R against a required version.

#define R_VERSION
#define R_Version(major, minor, patch) \
  (((major) * 65536) + ((minor) * 256) + (patch))

R_VERSION is the packed version number of the R being compiled against; R_Version() packs a major.minor.patch triple into the same format for comparison.

#include <Rversion.h>

#if defined(R_VERSION) && R_VERSION < R_Version(3, 2, 0)
SEXP Rf_installChar(SEXP x) {
  return Rf_install(CHAR(x));
}
#endif