Support R < 3.2#84
Conversation
|
By the way, the code is literally copied from base R 4.0 but works in all R versions since R-3.0 (the base::trimws
#> function (x, which = c("both", "left", "right"), whitespace = "[ \t\r\n]")
#> {
#> which <- match.arg(which)
#> mysub <- function(re, x) sub(re, "", x, perl = TRUE)
#> switch(which, left = mysub(paste0("^", whitespace, "+"),
#> x), right = mysub(paste0(whitespace, "+$"), x), both = mysub(paste0(whitespace,
#> "+$"), mysub(paste0("^", whitespace, "+"), x)))
#> }
#> <bytecode: 0x7fc5cbc74120>
#> <environment: namespace:base> |
|
Added |
|
Thank you for this. It was mentioned earlier by @bastistician in #77 and then I chose the easy way out :-). |
|
Awesome! Yes, remember that if you rely on only R > 3.0, package devs that want to support that version can use your package for unit testing, which will never happen to With our AMR package for example, we support clinical decision-making in low income countries, as we understood from users who work for Doctors Without Borders. With this pull request, you now add to this support as well!! And that’s really, really great. |
|
That is great to know Matthijs. And in the spirit of open source! I also defined |
|
Sorry for the late reply. There is an issue with
because that code is |
|
I don’t think that’s needed. This package is GPL-3 which is thus allowed, and the copied code was unchanged and already has the notice that is was copied from base R 4.0. But that my interpretation :) |
|
As far as I can see, the code distributed in tinytest's R/utils.R source file is currently missing an appropriate copyright notice for the parts copied from (or based on) base R source code, e.g., |
|
Thanks, will add references before the next release. |
This line in your
init.Rusestrimws():tinytest/pkg/R/init.R
Line 5 in 6ccbd9a
Unfortunately, this functions was only added in R-3.2, which makes this package unable to load in all versions of R-3.0 and R-3.1. This is a pity, since it's otherwise dependency free!
With this fix, users can test their package against older R versions.