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

advance deprecation cycle #141

Merged
merged 6 commits into from
Oct 18, 2024
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 NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(check,survey)
S3method(cite,survey)
S3method(clean,survey)
export(check)
export(cite)
export(clean)
export(contact_matrix)
export(download_survey)
Expand Down Expand Up @@ -44,7 +42,6 @@ importFrom(httr,status_code)
importFrom(httr,user_agent)
importFrom(jsonlite,fromJSON)
importFrom(jsonlite,toJSON)
importFrom(lifecycle,deprecate_warn)
importFrom(lubridate,period)
importFrom(lubridate,period_to_seconds)
importFrom(lubridate,years)
Expand Down
13 changes: 2 additions & 11 deletions R/check.r
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ check <- function(x, ...) UseMethod("check")
#' @description Checks that a survey fulfills all the requirements to work with the 'contact_matrix' function
#'
#' @param x A [survey()] object
#' @param columns deprecated argument, ignored
#' @param id.column the column in both the `participants` and `contacts` data frames that links contacts to participants
#' @param participant.age.column the column in the `participants` data frame containing participants' age; if this does not exist, at least columns "..._exact", "..._est_min" and "..._est_max" must (see the `estimated.participant.age` option in [contact_matrix()])
#' @param country.column the column in the `participants` data frame containing the country in which the participant was queried
Expand All @@ -19,20 +18,12 @@ check <- function(x, ...) UseMethod("check")
#' data(polymod)
#' check(polymod)
#' @export
check.survey <- function(x, columns, id.column = "part_id", participant.age.column = "part_age", country.column = "country", year.column = "year", contact.age.column = "cnt_age", ...) {
check.survey <- function(x, id.column = "part_id", participant.age.column = "part_age", country.column = "country", year.column = "year", contact.age.column = "cnt_age", ...) {
chkDots(...)
if (!is.data.frame(x$participants) || !is.data.frame(x$contacts)) {
stop("The 'participants' and 'contacts' elements of 'x' must be data.frames")
}

if (!missing(columns)) {
warning(
"The 'columns' argument is deprecated and will cause an error from ",
"version 1.0.0. The behaviour of the function now always corresponds ",
"to the previous documented case for `columns = TRUE`"
)
}

x <- clean(x)

success <- TRUE
Expand All @@ -49,7 +40,7 @@ check.survey <- function(x, columns, id.column = "part_id", participant.age.colu
exact.column <- paste(participant.age.column, "exact", sep = "_")
min.column <- paste(participant.age.column, "est_min", sep = "_")
max.column <- paste(participant.age.column, "est_max", sep = "_")

if (!((exact.column %in% colnames(x$participants)) ||
(min.column %in% colnames(x$participants) && max.column %in% colnames(x$participants)))) {
warning(
Expand Down
27 changes: 0 additions & 27 deletions R/cite.r
Original file line number Diff line number Diff line change
@@ -1,30 +1,3 @@
#' @export
cite <- function(x, ...) UseMethod("cite")
#' @name cite
#' @rdname cite
#' @title Citation for a survey
#'
#' @description Gets a full citation for a [survey()].
#'
#' @param x a character vector of surveys to cite
#' @param ... ignored
#' @return citation as bibentry
#' @importFrom utils bibentry
#' @importFrom httr GET content
#' @examples
#' data(polymod)
#' cite(polymod)
#' @export
cite.survey <- function(x, ...) {
warning(
"The cite function is deprecated and will stop working in version 1.0.0. ",
"Please use get_citation() instead."
)
chkDots(...)

get_citation(x)
}

#' @title Citation for a survey
#'
#' @description Gets a full citation for a [survey()].
Expand Down
Loading
Loading