Skip to content

Commit

Permalink
adding examples for CRAN requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
thiloshon committed Apr 10, 2019
1 parent 1faa2f9 commit b69a450
Show file tree
Hide file tree
Showing 18 changed files with 258 additions and 31 deletions.
4 changes: 2 additions & 2 deletions CRAN-RELEASE
Original file line number Diff line number Diff line change
@@ -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).
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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) <doi:10.3897/biss.2.25564>. T Gueta et al (2017) <doi:10.3897/tdwgproceedings.1.20311>.
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) <doi:10.3897/biss.2.25564>. T Gueta et al (2017) <doi:10.3897/tdwgproceedings.1.20311>.
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
Expand Down
22 changes: 13 additions & 9 deletions R/clean_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#' responses <- run_questionnaire()
#' cleaned_data <- clean_data(myData, responses)
#'
#' cleaned_data2 <- clean_data(myData)
#'
#' }
#'
#' @export
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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") {
Expand Down
39 changes: 38 additions & 1 deletion R/decision_making.R
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down Expand Up @@ -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)))

Expand All @@ -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() {
Expand Down
21 changes: 20 additions & 1 deletion R/generate_report.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
#' 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
#' @param cleaned_data The data with flagged records removed
#' @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 <-
Expand Down
50 changes: 50 additions & 0 deletions R/quality_checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#'
#' @examples
#'
#' if(interactive()){
#'
#' library(rgbif)
#' occdat <- occ_data(
Expand All @@ -30,6 +31,7 @@
#'
#' responses <- taxo_level(myData, 'SPECIES')
#'
#' }
#'
#' @export
taxo_level <- function(bddata, res = "SPECIES") {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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") {
Expand Down
7 changes: 3 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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 √
2 changes: 2 additions & 0 deletions man/clean_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion man/cleaning_function.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion man/create_report_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions man/earliest_date.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/get_checks_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/get_user_response.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions man/perform_Cleaning.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b69a450

Please sign in to comment.