pfmc-assessments / PacFIN.Utilities

R code to manipulate data from the PacFIN database for assessments
http://pfmc-assessments.github.io/PacFIN.Utilities
Other
7 stars 2 forks source link

getComps compatibility with nwfsc-assess/nwfscSurvey #8

Open kellijohnson-NOAA opened 5 years ago

kellijohnson-NOAA commented 5 years ago

The calculation of composition data from a dataframe with information on expansions (calculated from previous functions) should be essentially the same for the survey and the fishery data. It would be great to maintain one set of code for this in the future rather than two. Not sure which package it would be better to have it in, i.e., here or in nwfsc-assess/nwfscSurvey, it doesn't really matter though. The latter repository has the composition code within other functions, which would mean that the relevant section of code would need to be backed out of other functions. @CWetzel what are your thoughts? I am thinking for next round, not in 2019.

chantelwetzel-noaa commented 5 years ago

I am all for making both of these packages more consistent with each other. Historically they were developed separately because the data structures are different and the expansion approaches differ. I think brainstorming to see if there are ways to pull these packages together next year would a good idea.

kellijohnson-NOAA commented 3 years ago

@chantelwetzel-noaa I think the best way to start working on this is to work backwards starting from our desired output, i.e., a data frame that can go into SS, which will be a formatted version of a data frame that could in theory be formatted multiple different ways depending on your assessment model of choice.

Steps

  1. data_comp_long <- data.frame()
  2. data_comp_wide <- comp_wide2long(data_comp_long)
  3. write_comp(data_comp_wide), which would be called by users and the below functions would be the actual workhorses and we would have to find a way to set a global attribute or always write files for all available model types. Obviously, this will need to be fleshed out and I am just trying to capture thoughts.
    • write_comp.SS
    • write_comp.FIMS
    • write_comp.WHAM

Can you help me visualize what the data would look like in step 1? Would it be wide or long, i.e., would there be individual columns for each bin or would bin be a column with information for that bin stored in "value"? In theory, we could make both packages output a data frame that looked like this. Then all formatting / exporting would be done by code that worked on a consistent data frame agnostic to package.