ESHackathon / CiteSource

http://www.eshackathon.org/CiteSource/
GNU General Public License v3.0
16 stars 2 forks source link

Fix no visible binding NOTE #154

Closed LukasWallrich closed 1 year ago

LukasWallrich commented 1 year ago

For CRAN, we also need to fix all notes. @TNRiley do you understand the "no visible binding' note? It appears to (largely) concern your new functions - and comes from non-standard evaluation in dplyr and co.

Essentially, R complains because it is not obvious where variables are to be found. E.g., with

my_df %>% dplyr::mutate(cost = price * units)

R would not know whether price and units are in data, or in the global environment - by default, it expects them in the global environment, but can't find a visible binding there. Therefore, we need to use .data$ to confirm that the variables are to be found in the dataframe. You have done that in the count functions, so this might be clear to you already.

In any case, the same is now needed in the gt functions where column names are passed as arguments, for instance, see the .data$ below

 gt::tab_footnote(
      footnote = "Number of records imported from each source.",
      locations = gt::cells_column_labels(
        columns = .data$`Records Imported`
      )
    )
TNRiley commented 1 year ago

I've got this cleaned up, but it's not consistent. record_counts and record_summary_table use this .data$ method to call the data, but I was getting issues with that method for the precision_sensitivity_table. For that table function, I used another method, which seems like it should be fine. It might not be completely consistent, but then again I'm sure there are a bunch of inconsistencies considering we have had multiple people working on functions. @LukasWallrich I'm going to close this for now, but if we think it's going to be an issue, we can open it back up.