Open sgaichas opened 3 months ago
We can do this (move some functions to another location). So how were these functions being used prior to the survdat change referenced in PR #68 ?
These functions are still accessible if you have survdat
installed. Just use survdat:::post_strat
(three colons)
The function survdat::post_strat
was being used in Sean's script to apportion diet data from the trawl survey to GB Rpath groups. After the change, the script still ran but some groups ended up with negative values in their diet composition which is how @SarahJWeisberg caught the issue.
Andy's fix of survdat:::poststrat
(three colons) worked. We can discuss if it is worth revising PR #68
Looking at the history of this file, it doesn't look like it has been changed in over 4 years, other than what i did recently (which was to just not export the function with the package). So i'm thinking either this issue you are seeing always existed (however you would have probably spotted this problem before now) or the data being passed to the function is different. Probably need to look into this a little more
The error message I was getting when running with two colons survdat::post_strat(stations,GB, 'EPU'
was: "Error: 'post_strat' is not an exported object from 'namespace:survdat'"
I'm not sure if that helps solve the mystery.
@MaxGrezlik That error is expected since the function is no longer exported. An exported function is one that is available for a user. All exported functions are available by using the ::
. Any internal functions, used inside the package, deemed unnecessary for the user to interact with can only be accessed using :::
.
I issue i was referring to was the negative diet composition. We need to find out why this is occurring
The internal function
post_strat
is used for some Rpath input data (diet data) outsidesurvdat
.We may want to re-consider exporting this and some other functions (recently made internal in https://github.com/NOAA-EDAB/survdat/pull/68), or add them to a different package to allow use outside
survdat
@andybeet we can discuss with @SarahJWeisberg and @MaxGrezlik