AlisonLanski / IPEDSuploadables

Producing uploadable txt files for IPEDS reporting, one submission at a time
https://alisonlanski.github.io/IPEDSuploadables/
Other
8 stars 6 forks source link

Completions, extracips, error message "COUNT" missing #113

Closed Chicago-Dave closed 1 year ago

Chicago-Dave commented 1 year ago

Describe the bug produce_com_report function contains transformation of df & extracips using make_com_part_A, with both items and using a dplyr function 'bind_rows' as a final transformation for extracips (bind_rows(partA). This does not work. Column 'COUNT' is not generated for either this way. Desired combined df can be achieved with applying the make_com_partA function independently. bind_rows(make_com_part_A(df),make_com_part_A(extracips)) or make_com_part_A(df) -> partA make_com_part_A(extracips) %>% bind_rows(partA)

The error message is:

Error in dplyr::select(): ! Can't subset columns that don't exist. āœ– Column COUNT doesn't exist.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'produce_com_report'
  2. cite in function ''df1", extracips = df2 (Other parameters are 'ALL', 'uploadable', and TRUE,TRUE
  3. press CTL + ENTER
  4. See error (above)

Expected behavior Text file output to selected directory.

Screenshots Since this is aggregated data I feel like I could just give you the actual files but I am not fully comfortable with that.

Technical Setup (please complete the following information):

Additional context Examined the functions and followed the conditional paths. make_com_part_A is used on extracips, I think the problem in the function make_com_part_A is simple the select statement in line 10 for 'COUNT'. Taking that out make the function compliant without error and a COUNT column with a bunch of NAs for the CIPs with no completors.

The simplest workaround is to add a COUNT column of NA (and a 'DistanceEd' column of NA) to the extracips df. Not sure if the resulting text file will upload to IPEDs just yet.

Thank you for putting in all the time and sharing the functions.

work email: david.thomas@cuchicago.edu

AlisonLanski commented 1 year ago

Hi @Chicago-Dave thanks for finding this. My sample data com_cips includes the COUNT column, but I appear to have omitted that as a requirement in the documentation for the required columns, so yes, there is an issue. Thank you for finding this and reporting it.

At this moment, you can use the function correctly as-is by simply adding a COUNT column to your extracips dataframe and setting all values to 0.

I'll do a quick documentation update to add that information to the website and will consider in future releases if I should just collect the cip and add all of the required extra bits (Sex/RE/Count) within my functions instead of asking you to do it.

AlisonLanski commented 1 year ago

Updated documentation available here: https://alisonlanski.github.io/IPEDSuploadables/articles/setup_for_completions.html

Chicago-Dave commented 1 year ago

šŸ‘šŸ¼