diff --git a/CRAN-RELEASE b/CRAN-RELEASE index 6586d73..dc484bd 100644 --- a/CRAN-RELEASE +++ b/CRAN-RELEASE @@ -1,2 +1,2 @@ -This package was submitted to CRAN on 2019-03-19. -Once it is accepted, delete this file and tag the release (commit 155f7e2572). +This package was submitted to CRAN on 2019-04-10. +Once it is accepted, delete this file and tag the release (commit 1faa2f9a78). diff --git a/DESCRIPTION b/DESCRIPTION index 2f01c14..10d417c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,9 +1,9 @@ Package: bdclean Type: Package Title: A User-Friendly Biodiversity Data Cleaning App for the Inexperienced R User -Description: Provides features to manage complete work flow for biodiversity data cleaning, from uploading the data; gathering input from the user, in order to adjust cleaning procedures; perform the cleaning; and finally, generating various reports and several versions of the data. Facilitates user-level data cleaning, designed for the inexperienced R user. T Gueta et al (2018) . T Gueta et al (2017) . -Version: 0.1.14 -Date: 2019-04-08 +Description: Provides features to manage the complete workflow for biodiversity data cleaning. Uploading data, gathering input from users (in order to adjust cleaning procedures), cleaning data and finally, generating various reports and several versions of the data. Facilitates user-level data cleaning, designed for the inexperienced R user. T Gueta et al (2018) . T Gueta et al (2017) . +Version: 0.1.15 +Date: 2019-04-10 License: GPL-3 URL: https://github.com/bd-R/bdclean, https://bd-r.github.io/The-bdverse/index.html BugReports: https://github.com/bd-R/bdclean/issues diff --git a/R/clean_data.R b/R/clean_data.R index dd6c220..f295cbd 100644 --- a/R/clean_data.R +++ b/R/clean_data.R @@ -33,6 +33,8 @@ #' responses <- run_questionnaire() #' cleaned_data <- clean_data(myData, responses) #' +#' cleaned_data2 <- clean_data(myData) +#' #' } #' #' @export @@ -90,17 +92,11 @@ clean_data <- #' @return list with BdQuestionObjects containing user answers #' #' @examples -#' \dontrun{ -#' library(rgbif) -#' occdat1 <- occ_data( -#' country = 'AU', # Country code for australia -#' classKey = 359, # Class code for mammalia -#' limit = 5000, # Get only 5000 records -#' ) -#' myData <- occdat1$data +#' +#' if(interactive()){ #' #' responses <- run_questionnaire() -#' cleaned_data <- clean_data_new(myData, responses) +#' #' } #' #' @export @@ -136,6 +132,14 @@ run_questionnaire <- function(custom_questionnaire = NULL) { #' #' @param bd_question The BDQuestion object to get users responses. #' +#' @examples +#' +#' if(interactive()){ +#' +#' question <- BdQuestion() +#' responses <- get_user_response(question) +#' +#' } get_user_response <- function(bd_question) { # Child & ChildRouter already filtered in first loop above if (bd_question$question.type == "Atomic") { diff --git a/R/decision_making.R b/R/decision_making.R index 9007636..4195857 100644 --- a/R/decision_making.R +++ b/R/decision_making.R @@ -1,8 +1,23 @@ #' Data decision function (binary decision) required in bdclean internal usage. #' -#' NOTE: This is an package internal function. Do not use for external uses. +#' NOTE: This is an package internal function. Do not use for external uses. Exported to make it available for shiny app. #' #' @param bddata The dataframe to clean +#' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' cleaned_data <- cleaning_function(myData) +#' +#' } #' #' @export cleaning_function <- function(bddata) { @@ -42,6 +57,20 @@ cleaning_function <- function(bddata) { #' @param flagged_data The dataset with flags to be cleaned. #' @param cleaning_threshold The Cleaning tolerance. Not used in current version. #' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' cleaned_data <- perform_Cleaning(myData) +#' +#' } perform_Cleaning <- function(flagged_data, cleaning_threshold = 5) { flag_columns <- which(grepl("bdclean", names(flagged_data))) @@ -66,6 +95,14 @@ perform_Cleaning <- function(flagged_data, cleaning_threshold = 5) { #' Returning checks list, function required in bdclean internal usage. #' #' NOTE: This is an package internal function. Do not use for external uses. +#' +#' @examples +#' +#' if(interactive()){ +#' +#' all_checks <- get_checks_list() +#' +#' } #' #' @export get_checks_list <- function() { diff --git a/R/generate_report.R b/R/generate_report.R index 165ec99..9b127fe 100644 --- a/R/generate_report.R +++ b/R/generate_report.R @@ -1,6 +1,6 @@ #' Generate data required to create report, function required in bdclean internal usage. #' -#' NOTE: This is an package internal function. Do not use for external uses. +#' NOTE: This is an package internal function. Do not use for external uses. Exported to make it available for shiny app. #' #' @param input_data The input dataframe before cleaning #' @param flagged_data The flagged data for cleaning @@ -8,6 +8,25 @@ #' @param responses The BDQuestions object with user responses #' @param cleaning_true Flag specifying if the cleaning should be done, or just flagging #' @param format The format of the report to be generated +#' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' +#' question <- BdQuestion() +#' responses <- get_user_response(question) +#' +#' cleaned_data <- create_report_data(myData, myData, myData, responses, T, 'pdf') +#' +#' } #' #' @export create_report_data <- diff --git a/R/quality_checks.R b/R/quality_checks.R index 3d4903a..8bca579 100644 --- a/R/quality_checks.R +++ b/R/quality_checks.R @@ -19,6 +19,7 @@ #' #' @examples #' +#' if(interactive()){ #' #' library(rgbif) #' occdat <- occ_data( @@ -30,6 +31,7 @@ #' #' responses <- taxo_level(myData, 'SPECIES') #' +#' } #' #' @export taxo_level <- function(bddata, res = "SPECIES") { @@ -78,6 +80,22 @@ taxo_level <- function(bddata, res = "SPECIES") { #' #' @param bddata Bio diversity data in a data frame #' @param res The highest coordinate uncertainty required +#' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' +#' responses <- spatial_resolution(myData, 1500) +#' +#' } #' #' @export spatial_resolution <- function(bddata, res = 100) { @@ -114,6 +132,22 @@ spatial_resolution <- function(bddata, res = 100) { #' #' @param bddata Bio diversity data in a data frame #' @param res The earliest data required +#' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' +#' responses <- earliest_date(myData, '2000-01-01') +#' +#' } #' #' @export earliest_date <- function(bddata, res = "1700-01-01") { @@ -149,6 +183,22 @@ earliest_date <- function(bddata, res = "1700-01-01") { #' #' @param bddata Bio diversity data in a data frame #' @param res restriction of records with/without data, month, year fields +#' +#' @examples +#' +#' if(interactive()){ +#' +#' library(rgbif) +#' occdat <- occ_data( +#' country = 'AU', # Country code for australia +#' classKey = 359, # Class code for mammalia +#' limit = 50 # Get only 50 records +#' ) +#' myData <- occdat$data +#' +#' responses <- taxo_level(temporal_resolution, 'Day') +#' +#' } #' #' @export temporal_resolution <- function(bddata, res = "Day") { diff --git a/cran-comments.md b/cran-comments.md index 64419b8..6274ae1 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,14 +1,13 @@ ## Resubmission This is a resubmission. In this version I have: -* Addded small executables (outside of \dontrun{}). As the package has mainly a shiny app, most examples are in interactive mode. +* Addded small executables (outside of \dontrun{}) in all exported functions. As the package has mainly a shiny app, most examples are in interactive mode. -* Removed functions writting to disk by default. Using a temp folder instead. +* Fixed description as suggested. --- R CMD check results ----------------------------------------------------------------------------------------------- bdclean 0.1.13 ---- -Duration: 1m 26.6s +-- R CMD check results ----------------------------------------------------------------------------------------------- 0 errors √ | 0 warnings √ | 0 notes √ \ No newline at end of file diff --git a/man/clean_data.Rd b/man/clean_data.Rd index 0684982..269d98b 100644 --- a/man/clean_data.Rd +++ b/man/clean_data.Rd @@ -50,6 +50,8 @@ myData <- occdat$data responses <- run_questionnaire() cleaned_data <- clean_data(myData, responses) +cleaned_data2 <- clean_data(myData) + } } diff --git a/man/cleaning_function.Rd b/man/cleaning_function.Rd index 19f7337..60864ac 100644 --- a/man/cleaning_function.Rd +++ b/man/cleaning_function.Rd @@ -10,5 +10,21 @@ cleaning_function(bddata) \item{bddata}{The dataframe to clean} } \description{ -NOTE: This is an package internal function. Do not use for external uses. +NOTE: This is an package internal function. Do not use for external uses. Exported to make it available for shiny app. +} +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data +cleaned_data <- cleaning_function(myData) + +} + } diff --git a/man/create_report_data.Rd b/man/create_report_data.Rd index 4fe74d9..245adf8 100644 --- a/man/create_report_data.Rd +++ b/man/create_report_data.Rd @@ -21,5 +21,25 @@ create_report_data(input_data, flagged_data, cleaned_data, responses, \item{format}{The format of the report to be generated} } \description{ -NOTE: This is an package internal function. Do not use for external uses. +NOTE: This is an package internal function. Do not use for external uses. Exported to make it available for shiny app. +} +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data + +question <- BdQuestion() +responses <- get_user_response(question) + +cleaned_data <- create_report_data(myData, myData, myData, responses, T, 'pdf') + +} + } diff --git a/man/earliest_date.Rd b/man/earliest_date.Rd index b708158..7369cb0 100644 --- a/man/earliest_date.Rd +++ b/man/earliest_date.Rd @@ -34,3 +34,20 @@ eventDate temporal } +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data + +responses <- earliest_date(myData, '2000-01-01') + +} + +} diff --git a/man/get_checks_list.Rd b/man/get_checks_list.Rd index 8112a2c..6cccb1b 100644 --- a/man/get_checks_list.Rd +++ b/man/get_checks_list.Rd @@ -9,3 +9,12 @@ get_checks_list() \description{ NOTE: This is an package internal function. Do not use for external uses. } +\examples{ + +if(interactive()){ + +all_checks <- get_checks_list() + +} + +} diff --git a/man/get_user_response.Rd b/man/get_user_response.Rd index 378f8c3..7f5cf4e 100644 --- a/man/get_user_response.Rd +++ b/man/get_user_response.Rd @@ -12,3 +12,12 @@ get_user_response(bd_question) \description{ Internal function for getting user response } +\examples{ + +if(interactive()){ + +question <- BdQuestion() +responses <- get_user_response(question) + +} +} diff --git a/man/perform_Cleaning.Rd b/man/perform_Cleaning.Rd index 6cc2b5d..afd3b1b 100644 --- a/man/perform_Cleaning.Rd +++ b/man/perform_Cleaning.Rd @@ -14,3 +14,18 @@ perform_Cleaning(flagged_data, cleaning_threshold = 5) \description{ NOTE: This is an package internal function. Do not use for external uses. } +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data +cleaned_data <- perform_Cleaning(myData) + +} +} diff --git a/man/run_questionnaire.Rd b/man/run_questionnaire.Rd index 178ee03..6723857 100644 --- a/man/run_questionnaire.Rd +++ b/man/run_questionnaire.Rd @@ -16,17 +16,11 @@ list with BdQuestionObjects containing user answers Execute the Questionnaire and save user responses. } \examples{ -\dontrun{ -library(rgbif) -occdat1 <- occ_data( - country = 'AU', # Country code for australia - classKey = 359, # Class code for mammalia - limit = 5000, # Get only 5000 records -) -myData <- occdat1$data + +if(interactive()){ responses <- run_questionnaire() -cleaned_data <- clean_data_new(myData, responses) + } } diff --git a/man/spatial_resolution.Rd b/man/spatial_resolution.Rd index 2588fae..85f276a 100644 --- a/man/spatial_resolution.Rd +++ b/man/spatial_resolution.Rd @@ -34,3 +34,20 @@ coordinateUncertaintyInMeters spatial } +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data + +responses <- spatial_resolution(myData, 1500) + +} + +} diff --git a/man/taxo_level.Rd b/man/taxo_level.Rd index 166a7ac..6837393 100644 --- a/man/taxo_level.Rd +++ b/man/taxo_level.Rd @@ -36,6 +36,7 @@ taxonomic \examples{ +if(interactive()){ library(rgbif) occdat <- occ_data( @@ -47,5 +48,6 @@ myData <- occdat$data responses <- taxo_level(myData, 'SPECIES') +} } diff --git a/man/temporal_resolution.Rd b/man/temporal_resolution.Rd index fad762b..5cb1b72 100644 --- a/man/temporal_resolution.Rd +++ b/man/temporal_resolution.Rd @@ -34,3 +34,20 @@ day, month, year temporal } +\examples{ + +if(interactive()){ + +library(rgbif) +occdat <- occ_data( + country = 'AU', # Country code for australia + classKey = 359, # Class code for mammalia + limit = 50 # Get only 50 records +) +myData <- occdat$data + +responses <- taxo_level(temporal_resolution, 'Day') + +} + +}