-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from aim-rsf/improve-auto
Improve manual checking of categorisations
- Loading branch information
Showing
6 changed files
with
231 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#' user_categorisation | ||
#' | ||
#' This function is used within the domain_mapping function. \cr \cr | ||
#' It displays data properties to the user and requests a categorisation into a domain. \cr \cr | ||
#' An optional note can be included with the categorisation. | ||
#' | ||
#' @param data_element Name of the variable | ||
#' @param data_desc Description of the variable | ||
#' @param data_type Data type of the variable | ||
#' @return It returns a list containing the decision and decision note | ||
#' @export | ||
|
||
user_categorisation <- function(data_element,data_desc,data_type) { | ||
|
||
# print text to R console | ||
cat(paste( | ||
"\nDATA ELEMENT -----> ", data_element, | ||
"\n\nDESCRIPTION -----> ", data_desc, | ||
"\n\nDATA TYPE -----> ", data_type, "\n" | ||
)) | ||
|
||
state <- "redo" | ||
while (state == "redo") { | ||
|
||
# ask user for categorisation | ||
decision <- "" | ||
while (decision == "") { | ||
cat("\n \n") | ||
decision <- readline(prompt = "Categorise this variable: ") | ||
} | ||
|
||
# ask user for note on categorisation | ||
decision_note <- "" | ||
while (decision_note == "") { | ||
cat("\n \n") | ||
decision_note <- readline(prompt = "Notes (write 'N' if no notes): ") | ||
} | ||
|
||
# check if user wants to continue or redo | ||
cat("\n \n") | ||
state <- readline(prompt = "Press enter to continue or write 'redo' to correct previous answer: ") | ||
|
||
} | ||
|
||
return(list(decision = decision,decision_note = decision_note)) | ||
|
||
} |
Oops, something went wrong.