Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate functions that are moved to inbodb #81

Merged
merged 7 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ cache: packages
r_packages:
- pkgdown

r_binary_packages:
- rgdal

apt_packages:
- libudunits2-dev
- libgdal1-dev
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: inborutils
Title: Collection of Useful R Utilities
Version: 0.1.0.9072
Version: 0.1.0.9081
Description: While working on research projects, typical small functionalities
are useful across these projects. Instead of copy-pasting these functions in
all indidivual project repositories/folders, this package collects these
Expand Down
22 changes: 17 additions & 5 deletions R/connect_inbo_dbase.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,31 @@
#'
#' @return odbc connection
#'
#' @examples
#' \dontrun{
#' connection <- connect_inbo_dbase("D0021_00_userFlora")
#' connection <- connect_inbo_dbase("W0003_00_Lims")
#' }
#'
#' @name connect_inbo_dbase-deprecated
#' @usage connect_inbo_dbase(database_name)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section connect_inbo_dbase:
#' For \code{connect_inbo_dbase}, use [inbodb::connect_inbo_dbase()](https://inbo.github.io/inbodb/reference/connect_inbo_dbase.html)
#' @export
#'
#' @importFrom DBI dbGetQuery dbConnect dbListTables
#' @importFrom odbc odbc odbcListDrivers
#' @importFrom utils tail
#'
#' @examples
#' \dontrun{
#' connection <- connect_inbo_dbase("D0021_00_userFlora")
#' connection <- connect_inbo_dbase("W0003_00_Lims")
#' }
connect_inbo_dbase <- function(database_name) {

.Deprecated("inbodb::connect_inbo_dbase()", package = "inborutils")

# datawarehouse databases (sql08) start with an M, S or W; most
# transactional (sql07) with a D (by agreement with dba's)
if (any(startsWith(database_name, c("M", "S", "W")))) {
Expand Down
101 changes: 72 additions & 29 deletions R/florabank_queries.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ globalVariables("%LIKE%")
#' Omschrijving en Rekenwaarde. The first four variables identify the taxon,
#' the latter four variables relate to the taxon traits.
#'
#' @importFrom dplyr
#' tbl
#' collect
#' distinct
#' pull
#' %>%
#' inner_join
#' left_join
#' filter
#' select
#' rename
#' @importFrom rlang .data
#' @importFrom assertthat assert_that
#'
#' @export
#' @family florabank
#' @examples
#' \dontrun{
Expand All @@ -65,9 +50,37 @@ globalVariables("%LIKE%")
#' #disconnect from florabank
#' dbDisconnect(db_connectie)
#' }
#'
#' @name florabank_traits-deprecated
#' @usage florabank_traits(connection, trait_name, collect = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section florabank_traits:
#' For \code{florabank_traits}, use [inbodb::florabank_traits()](https://inbo.github.io/inbodb/reference/get_florabank_traits.html)
#'
#' @importFrom dplyr
#' tbl
#' collect
#' distinct
#' pull
#' %>%
#' inner_join
#' left_join
#' filter
#' select
#' rename
#' @importFrom rlang .data
#' @importFrom assertthat assert_that
#'
#' @export

florabank_traits <- function(connection, trait_name, collect = FALSE) {

.Deprecated("inbodb::get_florabank_traits()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")
assert_that(connection@info$dbname == "D0021_00_userFlora")
Expand Down Expand Up @@ -149,14 +162,6 @@ florabank_traits <- function(connection, trait_name, collect = FALSE) {
#' "Toponiem", "CommentaarTaxon", "CommentaarHabitat",
#' "WaarnemingID", "X_waarneming", "Y_waarneming", "X_meting", "Y_meting"
#'
#' @importFrom glue glue_sql
#' @importFrom assertthat assert_that
#' @importFrom dplyr
#' tbl
#' collect
#' sql
#'
#' @export
#' @family florabank
#' @examples
#' \dontrun{
Expand Down Expand Up @@ -204,10 +209,31 @@ florabank_traits <- function(connection, trait_name, collect = FALSE) {
#' # disconnect from florabank
#' dbDisconnect(db_connectie)
#' }
#'
#' @name florabank_observations-deprecated
#' @usage florabank_observations(connection, names, fixed = FALSE, collect = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section florabank_observations:
#' For \code{florabank_observations}, use [inbodb::florabank_observations()](https://inbo.github.io/inbodb/reference/get_florabank_observations.html)
#'
#' @importFrom glue glue_sql
#' @importFrom assertthat assert_that
#' @importFrom dplyr
#' tbl
#' collect
#' sql
#'
#' @export

florabank_observations <- function(connection, names, fixed = FALSE,
collect = FALSE) {

.Deprecated("inbodb::get_florabank_observations()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")
assert_that(connection@info$dbname == "D0021_00_userFlora")
Expand Down Expand Up @@ -321,12 +347,6 @@ florabank_observations <- function(connection, names, fixed = FALSE,
#' number of unique nested squares where the taxon was observed for that year
#' and 4 x 4 square combination.
#'
#' @importFrom glue glue_sql
#' @importFrom assertthat assert_that
#' @importFrom dplyr %>% group_by summarize n ungroup sql collect
#' @importFrom rlang .data
#'
#' @export
#' @family florabank
#' @examples
#' \dontrun{
Expand All @@ -346,6 +366,27 @@ florabank_observations <- function(connection, names, fixed = FALSE,
#' # disconnect from florabank
#' dbDisconnect(db_connectie)
#' }
#'
#' @name florabank_taxon_ifbl_year-deprecated
#' @usage florabank_taxon_ifbl_year(connection,
#' starting_year = 2010, ifbl_resolution = c("1km-by-1km", "4km-by-4km"),
#' taxongroup =
#' c("Vaatplanten", "Mossen", "Lichenen (korstmossen)", "Kranswieren"),
#' collect = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section florabank_taxon_ifbl_year:
#' For \code{florabank_taxon_ifbl_year}, use [inbodb::florabank_taxon_ifbl_year()](https://inbo.github.io/inbodb/reference/get_florabank_taxon_ifbl_year.html)
#'
#' @importFrom glue glue_sql
#' @importFrom assertthat assert_that
#' @importFrom dplyr %>% group_by summarize n ungroup sql collect
#' @importFrom rlang .data
#'
#' @export

florabank_taxon_ifbl_year <- function(connection,
starting_year = 2010,
Expand All @@ -357,6 +398,8 @@ florabank_taxon_ifbl_year <- function(connection,
"Kranswieren"),
collect = FALSE) {

.Deprecated("inbodb::get_florabank_taxon_ifbl_year()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")
assert_that(connection@info$dbname == "D0021_00_userFlora")
Expand Down
8 changes: 8 additions & 0 deletions R/inborutils-deprecated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#' @title Deprecated functions in package \pkg{inborutils}
#' @description The functions listed below are moved to package \pkg{inbodb}
#' and deprecated in \pkg{inborutils}. They will be defunct here in the near
#' future. Help pages for deprecated functions are available at
#' \code{help("<function>-deprecated")}
#' @name inborutils-deprecated
#' @keywords internal
NULL
25 changes: 19 additions & 6 deletions R/inboveg_classification.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
#' N2000-list, LocalClassification, Description of the Habitattype, Cover-code,
#' Cover in percentage.
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#' @importFrom dplyr collect tbl sql
#'
#' @export
#' @family inboveg
#' @examples
#' \dontrun{
Expand All @@ -46,12 +40,31 @@
#' dbDisconnect(con)
#' rm(con)
#' }
#'
#' @name inboveg_classification-deprecated
#' @usage inboveg_classification(connection, survey_name, classif, collect = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section inboveg_classification:
#' For \code{inboveg_classification}, use [inbodb::inboveg_classification()](https://inbo.github.io/inbodb/reference/get_inboveg_classification.html)
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#' @importFrom dplyr collect tbl sql
#'
#' @export

inboveg_classification <- function(connection,
survey_name,
classif,
collect = FALSE) {

.Deprecated("inbodb::get_inboveg_classification()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")

Expand Down
26 changes: 20 additions & 6 deletions R/inboveg_header.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@
#' Latitude, Longitude, Area (in m2), Length (in cm), Width (in cm), VagueDateType,
#' VagueDateBegin, VagueDateEnd, SurveyId, RecTypeID.
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#' @importFrom dplyr collect tbl sql
#'
#' @export
#' @family inboveg
#' @examples
#' \dontrun{
Expand All @@ -54,6 +48,24 @@
#' dbDisconnect(con)
#' rm(con)
#' }
#'
#' @name inboveg_header-deprecated
#' @usage inboveg_header(connection, survey_name, rec_type, multiple = FALSE,
#' collect = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section inboveg_header:
#' For \code{inboveg_header}, use [inbodb::inboveg_header()](https://inbo.github.io/inbodb/reference/get_inboveg_header.html)
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#' @importFrom dplyr collect tbl sql
#'
#' @export


inboveg_header <- function(connection,
Expand All @@ -62,6 +74,8 @@ inboveg_header <- function(connection,
multiple = FALSE,
collect = FALSE) {

.Deprecated("inbodb::get_inboveg_classification()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")

Expand Down
23 changes: 18 additions & 5 deletions R/inboveg_qualifiers.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
#' 2nd Description, 3rd QualifierCode, 3rd Description, Elucidation, in case
#' qualifier is 'NotSure', ParentID, QualifierResource
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#'
#' @export
#' @family inboveg
#' @examples
#' \dontrun{
Expand All @@ -52,13 +47,31 @@
#' rm(con)
#' }
#'
#' @name inboveg_qualifiers-deprecated
#' @usage inboveg_qualifiers(connection, survey_name, qualifier_type,
#' multiple = FALSE)
#' @seealso \code{\link{inborutils-deprecated}}
#' @keywords internal
NULL

#' @rdname inborutils-deprecated
#' @section inboveg_qualifiers:
#' For \code{inboveg_qualifiers}, use [inbodb::inboveg_qualifiers()](https://inbo.github.io/inbodb/reference/get_inboveg_qualifiers.html)
#'
#' @importFrom glue glue_sql
#' @importFrom DBI dbGetQuery
#' @importFrom assertthat assert_that
#'
#' @export


inboveg_qualifiers <- function(connection,
survey_name,
qualifier_type,
multiple = FALSE) {

.Deprecated("inbodb::get_inboveg_classification()", package = "inborutils")

assert_that(inherits(connection, what = "Microsoft SQL Server"),
msg = "Not a connection object to database.")

Expand Down
Loading