2

I am planning on using this function trimws but I have read here (How to trim leading and trailing whitespace in R?) that it is a relatively recent addition to R base (>=3.2.0).

Does this mean that if I use trimws in a package I should enforce the requirement R base version greater or equal than 3.2.0?

In general, do you check for every R base function you use when it was introduced, and if recent, you use an Imports value in DESCRIPTION to account for that?

Community
  • 1
  • 1
Ramiro Magno
  • 3,085
  • 15
  • 30
  • 1
    If you're using `trimws()` you definitely have that version of R as a dependency and should include it. I generally do the legwork to determine the base R version required, but that's often pretty easy for me as I usually depend on other packages (not just base R) and they generally have their base versions of R required listed. I've answered a couple questions on SO in the past few weeks that cover how to do this recursively. But I wish there was a list maintained somewhere on CRAN that has what new functions were added or changed in each version (in JSON or something similar). – hrbrmstr Aug 17 '16 at 14:53
  • In general, every package is updated but it has a minimum dependency. The package documentation from cran provides the details. Some packages also require additional packages. I mostly install each package with all of its dependencies to be safe. But if you want to read all updates that come out, I would suggest going here: https://journal.r-project.org/ – Dinesh.hmn Aug 17 '16 at 15:00
  • @hrbrmstr: Thank you for you comment. Could you post the links to these other answers you have given regarding this? – Ramiro Magno Aug 17 '16 at 15:00
  • 1
    Caught me being lazy ;-) http://stackoverflow.com/questions/38686427/determine-minimum-r-version-for-all-package-dependencies/38687310#38687310 & http://stackoverflow.com/questions/38738292/how-can-i-automatically-add-update-depends-imports-suggests-versions-in-descript/38743324#38743324 – hrbrmstr Aug 17 '16 at 15:08
  • You can also conditionally import functions, based on OS, R version, etc. If this is an essential function, add an R version requirement; if not, have no R version dependency in DESCRIPTION, conditionally import the function in NAMESPACE, and have your pkg issue an error on older R versions. – Thomas Aug 17 '16 at 16:13
  • @hrbrmstr: care to answer so that we can give this question some closure? – Ramiro Magno Feb 20 '19 at 15:43

0 Answers0