This function validates the infosheet provided to it by checking whether the
provided infosheet is compatible with the infosheet_template
. The function
early escapes only if the provided infosheet is not a dataframe or the variable
names are not the same as in the infosheet template.
validate_infosheet(infosheet)
infosheet | dataframe, filled out infosheet |
---|
The function returns a list for each checked statement. Each list contains
a type
vector that stores whether the statement passed the check "success"
or failed "warning" or "error", and a message
vector that contains information
about the nature of the check.
error, the provided infosheet is a dataframe
error, the provided infosheet does not have the same column names as the template
error, Firstname
variable has missing value for one of the contributors
error, Surname
variable has a missing value for one of the contributors
warning, the infosheet has duplicate names
warning, the infosheet has names with duplicate initials
error, the 'Order in publication'
variable has missing values
error, the 'Order in publication'
variable has duplicate values
error, both 'Primary affiliation'
and 'Secondary affiliation'
variables
are missing for one contributor
warning, there is no corresponding author added
warning, email address is missing for the corresponding author
warning, there is at least one CRediT role provided for all contributors
check_result <- validate_infosheet(infosheet = infosheet_template) # Show the results of the checks purrr::map(check_result, "type")#> $missing_surname #> [1] "success" #> #> $missing_firstname #> [1] "success" #> #> $duplicate_names #> [1] "success" #> #> $duplicate_initials #> [1] "success" #> #> $missing_order #> [1] "success" #> #> $duplicate_order #> [1] "success" #> #> $missing_affiliation #> [1] "success" #> #> $missing_corresponding #> [1] "success" #> #> $missing_credit #> [1] "warning" #> #> $missing_email #> [1] "success" #>#> $missing_surname #> [1] "There are no missing surnames." #> #> $missing_firstname #> [1] "There are no missing firstnames." #> #> $duplicate_names #> [1] "There are no duplicate names in the infosheet." #> #> $duplicate_initials #> [1] "There are no duplicate initials in the infosheet." #> #> $missing_order #> [1] "There are no missing values in the order of publication." #> #> $duplicate_order #> [1] "There are no duplicated order numbers in the infosheet." #> #> $missing_affiliation #> [1] "There are no missing affiliations in the infosheet." #> #> $missing_corresponding #> [1] "There is at least one author indicated as corresponding author." #> #> $missing_credit #> There is no CRediT taxonomy checked for the following row number(s): 4 #> #> $missing_email #> [1] "There are email addresses provided for all corresponding authors." #>