Skip to content

Changes in plot() generics #96

@rsbivand

Description

@rsbivand

R 4.0.0 News says (https://cran.r-project.org/doc/manuals/r-release/NEWS.html):

The plot() S3 generic function is now in package base rather than package graphics, as it is reasonable to have methods that do not use the graphics package. The generic is currently re-exported from the graphics namespace to allow packages importing it from there to continue working, but this may change in future.

Packages which define S4 generics for plot() should be re-installed and package code using such generics from other packages needs to ensure that they are imported rather than rely on their being looked for on the search path (as in a namespace, the base namespace has precedence over the search path).

This led to me being contacted by a user who has a local package that stopped working in R 4, because inside his package which depended on maptools, which depends on sp (but his package didn't depend on sp), in R<4, plot() from sp was found in the search path, but in R4, base plot() was found. I advised adding sp:: to the plot call to disambiguate (this worked), or doing NAMESPACE properly (I didn't try).

A side note: should we consider importing plot from base in sp rather than graphics in R>=4?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions