Skip to content

Commit

Permalink
bug fixes in renew processed mthd
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Mar 12, 2024
1 parent a55225b commit 4b62fcf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
11 changes: 7 additions & 4 deletions R/mthd_renew.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ methods::setMethod("renew", methods::className("vicinity_points", package = "vic
#' @description renew.vicinity_processed() is a renew method that renews an instance of a class by updating it with new data. This method is implemented for the ready4 submodule class for tibble object lookup table of meta-data for spatial data packs (imported and pre-processed data). The function is called for its side effects and does not return a value.
#' @param x An instance of `vicinity_processed`, a ready4 submodule class for tibble object lookup table of meta-data for spatial data packs (imported and pre-processed data).
#' @param args_ls Arguments (a list), Default: NULL
#' @param additional_detail_chr Additional detail (a character vector), Default: character(0)
#' @param area_type_chr Area type (a character vector), Default: character(0)
#' @param area_bndy_yr_chr Area boundary year (a character vector), Default: character(0)
#' @param country_chr Country (a character vector), Default: character(0)
Expand All @@ -41,19 +42,20 @@ methods::setMethod("renew", methods::className("vicinity_points", package = "vic
#' @param region_chr Region (a character vector), Default: character(0)
#' @param source_reference_chr Source reference (a character vector), Default: character(0)
#' @param year_chr Year (a character vector), Default: character(0)
#' @param year_end_chr Year end (a character vector), Default: ycharacter(0)
#' @param year_end_chr Year end (a character vector), Default: character(0)
#' @param year_start_chr Year start (a character vector), Default: character(0)
#' @param what_1L_chr What (a character vector of length one), Default: 'table'
#' @return x (An object)
#' @rdname renew-methods
#' @export
#' @importFrom rlang current_env
#' @importFrom ready4 update_tb_r3 renew
renew.vicinity_processed <- function (x, args_ls = NULL, area_type_chr = character(0), area_bndy_yr_chr = character(0),
renew.vicinity_processed <- function (x, args_ls = NULL, additional_detail_chr = character(0),
area_type_chr = character(0), area_bndy_yr_chr = character(0),
country_chr = character(0), data_type_chr = character(0),
main_feature_chr = character(0), name_chr = character(0),
region_chr = character(0), source_reference_chr = character(0),
year_chr = character(0), year_end_chr = ycharacter(0), year_start_chr = character(0),
year_chr = character(0), year_end_chr = character(0), year_start_chr = character(0),
what_1L_chr = "table")
{
if (what_1L_chr == "names") {
Expand All @@ -68,7 +70,8 @@ renew.vicinity_processed <- function (x, args_ls = NULL, area_type_chr = charact
year_end_chr = args_ls[[8]], main_feature_chr = args_ls[[9]])
}
else {
fn_env_ls <- as.list(rlang::current_env())[-1]
fn_env_ls <- as.list(rlang::current_env())[-c(1,
2, 15)]
x <- ready4::update_tb_r3(x, fn = renew.vicinity_processed,
fn_env_ls = fn_env_ls)
}
Expand Down
5 changes: 3 additions & 2 deletions data-raw/mthds/renew.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
renew.vicinity_processed <- function(x, ## add_att_tb_to_processed_lup & add_attrs_to_processed_lup
args_ls = NULL,
additional_detail_chr = character(0), ###
area_type_chr = character(0),
area_bndy_yr_chr = character(0),
country_chr = character(0),
Expand All @@ -9,7 +10,7 @@ renew.vicinity_processed <- function(x, ## add_att_tb_to_processed_lup & add_att
region_chr = character(0),
source_reference_chr = character(0),
year_chr = character(0),
year_end_chr = ycharacter(0),
year_end_chr = character(0),
year_start_chr = character(0),
what_1L_chr = "table"){
if(what_1L_chr == "names"){
Expand All @@ -29,7 +30,7 @@ renew.vicinity_processed <- function(x, ## add_att_tb_to_processed_lup & add_att
year_end_chr = args_ls[[8]],
main_feature_chr = args_ls[[9]])
}else{
fn_env_ls <- as.list(rlang::current_env())[-1]
fn_env_ls <- as.list(rlang::current_env())[-c(1,2,15)]
x <- ready4::update_tb_r3(x,
fn = renew.vicinity_processed,
fn_env_ls = fn_env_ls)
Expand Down
8 changes: 6 additions & 2 deletions man/renew-methods.Rd

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

0 comments on commit 4b62fcf

Please sign in to comment.