Skip to content

Check input #3

@TuomasBorman

Description

@TuomasBorman

Function structure discussed here: #2

The first step in functions is to check that the input is in correct format. The function could be in this format:

.check_formula <- function(x, formula, features){
     
}

The function could:

  1. Extract variables from formula
  2. Check with what slot the left hand side (LHS) of formula matches.
    • Give error if it does not match with anything
    • Give error if it matches with multiple slots: "This variable name is ambiguous; it can be found from x and y. Rename variables."
  3. Check if right-hand side (RHS) variables (predictors) are present.
    • if LHS specifies assay: they must be present in colData
    • if LHS specifies colData: they must be present in colData
    • if LHS specifies rowData: they must be in rowData
    • Give errors if they match with multiple variables.
  4. features is applicable only when LHS spcifies assay. It must select rows by their name or index.

You can add these to utils.R.

To harmonize input check messages for generic variables, you can copy-paste input checks from miaTime: https://github.com/microbiome/miaTime/blob/3f90283afeed3475082b64726eed357f73e06a09/R/utils.R#L7

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions