Skip to content

Trouble with S4-style coercion #1

Description

@baddstats

Currently the spatstat.convert package Depends on all the packages sp, sf, terra.
It would be better if these packages were only Suggested so that the user doesn't have to install them all.

However, listing sp, sf, terra as Suggested packages doesn't seem to work, as it creates problems with the S4-style coercion

as(X, "foo")

giving error messages like

package slot missing from signature for generic ‘coerce’ 
and classes "ppp", "SpatialPoints"
Unknown class "SpatialPoints"

when spatstat.convert was installed, when the suggested package was loaded, or when functions were executed.

If I inserted a declaration of virtual class "SpatialPoints" then I would get

 package slot missing from signature for generic ‘coerce’
 and classes "ppp", "SpatialPoints" 
 cannot use with duplicate class names (the package may need to be re-installed)

Reinstalling the entire R installation and all the packages did not fix the problem.

The only way I could avoid this was to put all the packages sp, sf, terra in the Depends field so that all the relevant classes are known.

A better solution would be welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions