dependencies - Official guidelines for using functions newly added to base R -


i writing package performs statistical analysis while handling missing values. using wonderful, life-changing function anyna added sometime after 3.0 (commit). added function people might want use olsonnames.

so using function, package won't work on older versions of r. see 4 options dealing this.

  1. make whole package depend on r >= 3.1 in description.

  2. redefine function in source.

  3. redefine function if user using <3.1 , don't define if using >= 3.1 or make function check version each time e.g.

    anyna <- function(x)   if(as.numeric(r.version()$minor) > 3.1){     return(anyna(x)   } else {     return(any(is.na(x))   } } 

    or

    if(as.numeric(r.version()$minor) > 3.1){   anyna <- base::anyna } else {   anyna <- function(x) any(is.na(x)) }           

    i'm not sure second 1 work in package source code.

  4. rewrite code using any(is.na(x)).

my concrete question is there official cran preference 1 of these?

failing that, there reasons use 1 on others? eyes have failings. 1) seems unnecessary require users have r >= 3.1 sake of small function. 2) if redefine function, improvements made function in r base won't used in package. 3) seems messy. also, if base r version of function changes might end hard fix bugs occur in r versions. 4) code readability reduced.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -