Compares current R version with a given target version, which may be useful for implementing version dependent code.

testRversion(x, test = 1L)

Arguments

x

target version to compare with.

test

numeric value that indicates the comparison to be carried out. The comparison is based on the result from utils::compareVersion(R.version, x):

  • 1: is R.version > x?

  • 0: is R.version = x?

  • -1: is R.version < x?

Value

a logical

Examples

testRversion("2.14")
#> [1] TRUE
testRversion("2.15")
#> [1] TRUE
testRversion("10")
#> [1] FALSE
testRversion("10", test = -1)
#> [1] TRUE
testRversion("< 10")
#> [1] TRUE
testRversion(Rversion())
#> [1] FALSE
testRversion(paste0('=', Rversion()))
#> [1] TRUE