Skip to content

NutritionTools V2 thoughts and ideas #2

@TomCodd

Description

@TomCodd

Updates to existing Functions

General

  • Tidyverse integration. The best way to pass a column name as an argument to a tidyverse function is convert it to quosure using enquo()

Fuzzy Matcher

  • Add capability to include extra metadata column (e.g. source FCT for multimatches) in matching screen
  • Add input - output file name. Will (hopefully) allow for FM integration into a script, providing a script can continue after an R Shiny window is opened and closed. Need to check whether this works for various ways of closing a Shiny window
  • Liberty's idea - any unmatched items automatically go to a new window, to be matched against the whole list (like the function Liberty is working on)
  • Multimatch - add an alternative tickbox column, but this one doesn't lock as soon as an option is picked

New Functions

Automatic Renamer

  • Reads in all columns
  • Fuzzy Matches against a lookup table included in the package (the table is based on the name changes we made in the Fisheries project), and renames automatically
  • Outputs the results, showing the changes - the least accurate changes first
  • Show how to correct names if not correct
  • Set up all calculator functions (past and present) to default to these new names, for ease of use. Ideally, if this script is run first, a lot of the other scripts will not need column names as inputs, as it will know them.
  • Also set all columns to correct type (numeric etc)

Header condenser

  • Might already exist?
  • Usecase is when an FCT spreads its header across multiple rows
  • input is the number of rows its spread over
  • Combines the rows and header

Irregularity Checker

  • lists all columns or rows that contain special characters, is mostly empty, any other irregularities.

Empty Remover

  • Janitor already does something like this, but only for NA's - create one that will go over an entire dataset and not only remove columns and rows only populated by NA's, but those only populated by blank cells too.

Unit Checker

  • Once the headers are renamed using the automatic renamer, this can be done
  • Compares each nutrients's numeric data against a dataset already in the package, which describes the bell curve of expected values that that nutrient should lie within
  • If it falls outside the parameter, flags it for checking - in case its using a non-standard unit

Grouping_Finder

  • Reads an FCT, looking for structure irregularities that might indicate in-table grouping (e.g. rows that only have one cell filled)
  • Either take a column as input (if theres one column that contains the irregular cells) or checks automatically
  • Automatically creates a column for the cell and atributes it

Subfunctions

Column Input Checker

  • Used in other functions for input - allows more flexibility with inputs which are meant to refer to column names.
  • e.g., if you need to refer to the column "Carbs" in position 4, this function would mean the user could input "Carbs", Carbs, df$Carbs, df$4, or 4, and it would convert it to a standard that the function will use.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions