Skip to content

Relevant features of new R versions #196

@Bisaloo

Description

@Bisaloo

This is a bookmark issue to keep in mind the features we could leverage from the newer R versions in cases we accept to bump the minimum required R version in the future:

Already implemented
  • R 3.6.0

    • delayed S3 registration: opens up the possibility of a as.cimg method for rimg objects even though imager is in Suggests
    • use hcl.colors(n, palette = "cividis") instead of viridisLite::cividis(n) (removes the viridisLite dependency): see PR Use new R palette functions to get colours #184
  • R 4.0.0

    • don't import plot/plot.default (it's in base and not in graphics anymore)
    • use the palette.colors() function to specify colourblind friendly colour palettes: see PR Use new R palette functions to get colours #184
    • use list2DF() instead of do.call(cbind, ...)
  • R 4.1.0

    • Use native pipe |> in examples etc. I like pipes (TW).
    • apply(x, MARGIN, FUN, simplify = FALSE) instead of lapply(seq_len(nrow/ncol(x)), FUN)
  • R 4.4.0

    • val <- val %||% default, particularly useful to set defaults to arguments, as in

      pavo/R/segplot.R

      Lines 48 to 62 in a3e3986

      if (is.null(arg$pch)) {
      arg$pch <- 19
      }
      if (is.null(arg$xlim)) {
      arg$xlim <- c(-1.05, 1.01)
      }
      if (is.null(arg$ylim)) {
      arg$ylim <- c(-1.05, 1.05)
      }
      if (is.null(arg$xlab)) {
      arg$xlab <- " "
      }
      if (is.null(arg$ylab)) {
      arg$ylab <- " "
      }
  • R 4.5.0

    • grepv():

      pavo/R/bootcoldist.R

      Lines 175 to 177 in 6713103

      datattributes <- grep("names", names(attributes(vismodeldata)),
      invert = TRUE, value = TRUE, fixed = TRUE
      )

Feel free to edit this issue to add more items

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions