Skip to content

alternative to depths<- for constructing a SoilProfileCollection #346

@brownag

Description

@brownag

Based on the perennial challenges with teaching the depths<- SPC construction syntax, I have been thinking about providing an alternative.

We have had the SoilProfileCollection() function for several years. It is a slightly-safe (but not safe enough to use in general) low-level wrapper around the new("SoilProfileCollection") constructor that is used in one place internally.

If we define an S3 generic "SoilProfileCollection" function we could support methods for both character (current method) and data.frame (new method), and possibly other object types as input to create a S4 SoilProfileCollection object

I have prototyped this here: https://github.com/brownag/aqp/tree/spc-constructor1

With this setup we can keep the character method (which has never been recommended for public use but is exported), and add a data.frame method that doesnt rely on being on LHS of assignment operator or have formula/RHS argument syntax. Internally the prototype implementation uses depths<-. I am not recommending we deprecate that, but perhaps supersede it (suggest that it not be used in new code)

Also, I think we could easily make the character method internal, it is only used in a couple places, and as far as I am aware it has not been legitimately used in the wild. The new prototype data.frame method should be safer and also fully backward compatible provided that the arguments are explicitly specified (not relying on positional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions