Skip to content

Commit 9a8f600

Browse files
attempted fix for class fails
1 parent 8305315 commit 9a8f600

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+216
-52
lines changed

NAMESPACE

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export("%>%")
4+
export("crs_nbr_dbl<-")
5+
export("merge_with_chr_vec<-")
6+
export("save_type<-")
47
export(add_ds_to_dv_repo)
58
export(add_dv_meta_to_imp_lup)
69
export(add_files_to_dv)
@@ -11,6 +14,7 @@ export(assert_matches_chr)
1114
export(assert_single_row_tb)
1215
export(bind_lups)
1316
export(bind_lups.ready4_dictionary)
17+
export(crs_nbr_dbl)
1418
export(download_data)
1519
export(get_data)
1620
export(get_data.ready4_dv_import_lup)
@@ -44,6 +48,7 @@ export(make_pt_ready4_dist)
4448
export(make_pt_ready4_dv_import_lup)
4549
export(make_pt_ready4_par_struc_mape)
4650
export(make_r3_from_csv_tb)
51+
export(merge_with_chr_vec)
4752
export(read_import_from_csv)
4853
export(ready4_all_import_lup)
4954
export(ready4_dictionary)
@@ -52,6 +57,7 @@ export(ready4_dv_import_lup)
5257
export(ready4_par_struc_mape)
5358
export(remove_labels_from_ds)
5459
export(save_raw)
60+
export(save_type)
5561
export(transform_csv_col_to_ls_col)
5662
export(update_src_loc_to_url)
5763
export(update_src_loc_to_url.ready4_all_import_lup)
@@ -66,6 +72,7 @@ export(write_dv_ds)
6672
export(write_dv_ds_fls)
6773
export(write_dv_fl_to_loc)
6874
export(write_fls_to_dv_ds)
75+
export(write_paired_ds_fls_to_dv)
6976
export(write_pkg_dss_to_dv_ds_csvs)
7077
export(write_to_add_urls_to_dss)
7178
export(write_to_copy_fls_to_dv_dir)
@@ -130,3 +137,4 @@ importFrom(tidyr,gather)
130137
importFrom(utils,data)
131138
importFrom(utils,getFromNamespace)
132139
importFrom(utils,read.csv)
140+
importFrom(utils,write.csv)

R/fn_add.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,14 @@ add_files_to_dv <- function (files_tb, data_dir_rt_1L_chr = ".", ds_url_1L_chr,
139139
#' @description add_labels_from_dictionary() is an Add function that updates an object by adding data to that object. Specifically, this function implements an algorithm to add labels from dictionary. Function argument ds_tb specifies the object to be updated. The function returns Labelled dataset (a tibble).
140140
#' @param ds_tb Dataset (a tibble)
141141
#' @param dictionary_tb Dictionary (a tibble)
142-
#' @param remove_old_lbls_1L_lgl PARAM_DESCRIPTION, Default: F
142+
#' @param remove_old_lbls_1L_lgl Remove old lbls (a logical vector of length one), Default: F
143143
#' @return Labelled dataset (a tibble)
144144
#' @rdname add_labels_from_dictionary
145145
#' @export
146146
#' @importFrom ready4fun remove_lbls_from_df
147147
#' @importFrom dplyr filter mutate case_when
148148
#' @importFrom purrr reduce
149149
#' @importFrom Hmisc label
150-
#' @keywords internal
151150
add_labels_from_dictionary <- function (ds_tb, dictionary_tb, remove_old_lbls_1L_lgl = F)
152151
{
153152
if (remove_old_lbls_1L_lgl)

R/fn_get.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ get_file_from_dv <- function (ds_ui_1L_chr, fl_nm_1L_chr, save_fmt_1L_chr, repo_
4444
#' @importFrom purrr map2_chr
4545
#' @importFrom ready4fun get_from_lup_obj
4646
#' @importFrom tibble as_tibble
47-
#' @keywords internal
4847
get_fl_id_from_dv_ls <- function (ds_ls, fl_nm_1L_chr, nms_chr = NA_character_)
4948
{
5049
if (is.na(nms_chr[1])) {

R/fn_read.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Read import from comma separated variables file
22
#' @description read_import_from_csv() is a Read function that reads an R script into memory. Specifically, this function implements an algorithm to read import from comma separated variables file. Function argument file_ref_chr specifies the path to object. The function returns Import (a ready4 S3).
33
#' @param file_ref_chr File reference (a character vector)
4-
#' @param is_url_1L_lgl PARAM_DESCRIPTION, Default: F
4+
#' @param is_url_1L_lgl Is url (a logical vector of length one), Default: F
55
#' @return Import (a ready4 S3)
66
#' @rdname read_import_from_csv
77
#' @export

R/fn_transform.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' Transform comma separated variables file column to list column
2-
#' @description transform_csv_col_to_ls_col() is a Transform function that edits an object in such a way that core object attributes - e.g. shape, dimensions, elements, type - are altered. Specifically, this function implements an algorithm to transform comma separated variables file column to list column. Function argument csv_col specifies the object to be updated. The function returns List column (a list).
3-
#' @param csv_col_xx PARAM_DESCRIPTION
2+
#' @description transform_csv_col_to_ls_col() is a Transform function that edits an object in such a way that core object attributes - e.g. shape, dimensions, elements, type - are altered. Specifically, this function implements an algorithm to transform comma separated variables file column to list column. Function argument csv_col_xx specifies the object to be updated. The function returns List column (a list).
3+
#' @param csv_col_xx Comma separated variables file column (an output object of multiple potential types)
44
#' @return List column (a list)
55
#' @rdname transform_csv_col_to_ls_col
66
#' @export

R/fn_update.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#' @description update_tb_src_loc_to_url_sgl_tb() is an Update function that edits an object, while preserving core object attributes. Specifically, this function implements an algorithm to update tibble source local to url sgl tibble. Function argument x specifies the object to be updated. Argument y provides the object to be updated. The function returns Updated (a tibble).
33
#' @param x An object
44
#' @param y PARAM_DESCRIPTION
5-
#' @param local_to_url_vec_chr PARAM_DESCRIPTION
6-
#' @param urls_vec_chr PARAM_DESCRIPTION
5+
#' @param local_to_url_vec_chr Local to url vec (a character vector)
6+
#' @param urls_vec_chr Urls vec (a character vector)
77
#' @return Updated (a tibble)
88
#' @rdname update_tb_src_loc_to_url_sgl_tb
99
#' @export

R/fn_write.R

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ write_dv_fl_to_loc <- function (ds_ui_1L_chr, fl_nm_1L_chr = NA_character_, fl_i
107107
#' @importFrom stats setNames
108108
#' @importFrom purrr map_int
109109
#' @importFrom dataverse get_dataset
110-
#' @keywords internal
111110
write_fls_to_dv_ds <- function (dss_tb, dv_nm_1L_chr, ds_url_1L_chr, wait_time_in_secs_int = 5L,
112111
make_local_copy_1L_lgl = F, parent_dv_dir_1L_chr, paths_to_dirs_chr,
113112
inc_fl_types_chr = NA_character_, key_1L_chr = Sys.getenv("DATAVERSE_KEY"),
@@ -138,6 +137,41 @@ write_fls_to_dv_ds <- function (dss_tb, dv_nm_1L_chr, ds_url_1L_chr, wait_time_i
138137
}
139138
return(ds_ls)
140139
}
140+
#' Write paired dataset files to dataverse
141+
#' @description write_paired_ds_fls_to_dv() is a Write function that writes a file to a specified local directory. Specifically, this function implements an algorithm to write paired dataset files to dataverse. The function is called for its side effects and does not return a value. WARNING: This function writes R scripts to your local environment. Make sure to only use if you want this behaviour
142+
#' @param ds_tb Dataset (a tibble)
143+
#' @param fl_nm_1L_chr File name (a character vector of length one)
144+
#' @param desc_1L_chr Description (a character vector of length one)
145+
#' @param ds_url_1L_chr Dataset url (a character vector of length one), Default: 'https://doi.org/10.7910/DVN/2Y9VF9'
146+
#' @param pkg_dv_dir_1L_chr Package dataverse directory (a character vector of length one), Default: 'data-raw/dataverse'
147+
#' @param data_dir_rt_1L_chr Data directory root (a character vector of length one), Default: '.'
148+
#' @param key_1L_chr Key (a character vector of length one), Default: Sys.getenv("DATAVERSE_KEY")
149+
#' @param server_1L_chr Server (a character vector of length one), Default: Sys.getenv("DATAVERSE_SERVER")
150+
#' @return NULL
151+
#' @rdname write_paired_ds_fls_to_dv
152+
#' @export
153+
#' @importFrom utils write.csv
154+
#' @importFrom stats setNames
155+
write_paired_ds_fls_to_dv <- function (ds_tb, fl_nm_1L_chr, desc_1L_chr, ds_url_1L_chr = "https://doi.org/10.7910/DVN/2Y9VF9",
156+
pkg_dv_dir_1L_chr = "data-raw/dataverse", data_dir_rt_1L_chr = ".",
157+
key_1L_chr = Sys.getenv("DATAVERSE_KEY"), server_1L_chr = Sys.getenv("DATAVERSE_SERVER"))
158+
{
159+
if (!dir.exists(pkg_dv_dir_1L_chr))
160+
dir.create(pkg_dv_dir_1L_chr)
161+
pkg_dv_dir_1L_chr <- paste0(pkg_dv_dir_1L_chr, "/", fl_nm_1L_chr)
162+
if (!dir.exists(pkg_dv_dir_1L_chr))
163+
dir.create(pkg_dv_dir_1L_chr)
164+
ds_tb %>% saveRDS(paste0(pkg_dv_dir_1L_chr, "/", fl_nm_1L_chr,
165+
".RDS"))
166+
readRDS(paste0(pkg_dv_dir_1L_chr, "/", fl_nm_1L_chr, ".RDS")) %>%
167+
utils::write.csv(file = paste0(pkg_dv_dir_1L_chr, "/",
168+
fl_nm_1L_chr, ".csv"), row.names = F)
169+
make_files_tb(paths_to_dirs_chr = pkg_dv_dir_1L_chr, recode_ls = c(rep(desc_1L_chr,
170+
2)) %>% as.list() %>% stats::setNames(c(rep(fl_nm_1L_chr,
171+
2)))) %>% add_files_to_dv(data_dir_rt_1L_chr = data_dir_rt_1L_chr,
172+
ds_url_1L_chr = ds_url_1L_chr, key_1L_chr = key_1L_chr,
173+
server_1L_chr = server_1L_chr)
174+
}
141175
#' Write package datasets to dataverse dataset comma separated variables files
142176
#' @description write_pkg_dss_to_dv_ds_csvs() is a Write function that writes a file to a specified local directory. Specifically, this function implements an algorithm to write package datasets to dataverse dataset comma separated variables files. The function returns Dataset (a list).
143177
#' @param pkg_dss_tb Package datasets (a tibble)
@@ -156,7 +190,6 @@ write_fls_to_dv_ds <- function (dss_tb, dv_nm_1L_chr, ds_url_1L_chr, wait_time_i
156190
#' @importFrom utils data
157191
#' @importFrom dplyr mutate_if
158192
#' @importFrom stringr str_c
159-
#' @keywords internal
160193
write_pkg_dss_to_dv_ds_csvs <- function (pkg_dss_tb, dv_nm_1L_chr, ds_url_1L_chr, wait_time_in_secs_int = 5L,
161194
dev_pkg_nm_1L_chr = ready4fun::get_dev_pkg_nm(), parent_dv_dir_1L_chr = "../../../../Data/Dataverse",
162195
key_1L_chr = Sys.getenv("DATAVERSE_KEY"), server_1L_chr = Sys.getenv("DATAVERSE_SERVER"))
@@ -177,7 +210,7 @@ write_pkg_dss_to_dv_ds_csvs <- function (pkg_dss_tb, dv_nm_1L_chr, ds_url_1L_chr
177210
}
178211
#' Write to add urls to datasets
179212
#' @description write_to_add_urls_to_dss() is a Write function that writes a file to a specified local directory. Specifically, this function implements an algorithm to write to add urls to datasets. The function returns Package datasets (a tibble).
180-
#' @param ds_url_1L_chr PARAM_DESCRIPTION
213+
#' @param ds_url_1L_chr Dataset url (a character vector of length one)
181214
#' @param pkg_dss_tb Package datasets (a tibble)
182215
#' @param pkg_nm_1L_chr Package name (a character vector of length one), Default: ready4fun::get_dev_pkg_nm()
183216
#' @return Package datasets (a tibble)

R/gs_crs_nbr_dbl.R renamed to R/gnrc_crs_nbr_dbl.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#' crs_nbr_dbl
2+
#' @description S4 Generic function to get the value of the slot crs_nbr_dbl
3+
#' @rdname crs_nbr_dbl-methods
4+
#' @param x An object
5+
#'
6+
#' @export
7+
8+
methods::setGeneric("crs_nbr_dbl", function(x) standardGeneric("crs_nbr_dbl"))
9+
#' crs_nbr_dbl
210
#' @name crs_nbr_dbl-ready4_script_data
311
#' @description Get the value of the slot crs_nbr_dbl for S4 objects of class ready4_script_data
412
#' @param x An object of class ready4_script_data
@@ -9,6 +17,15 @@ methods::setMethod("crs_nbr_dbl", methods::className("ready4_script_data"), func
917
x@crs_nbr_dbl
1018
})
1119
#' crs_nbr_dbl<-
20+
#' @description S4 Generic function to set the value of the slot crs_nbr_dbl
21+
#' @rdname crs_nbr_dbl_set-methods
22+
#' @param x An object
23+
#' @param value Value to be assigned to x
24+
#'
25+
#' @export
26+
27+
methods::setGeneric("crs_nbr_dbl<-", function(x, value) standardGeneric("crs_nbr_dbl<-"))
28+
#' crs_nbr_dbl<-
1229
#' @name crs_nbr_dbl<--ready4_script_data
1330
#' @description Set the value of the slot crs_nbr_dbl for S4 objects of class ready4_script_data
1431
#' @param x An object of class ready4_script_data

R/gs_merge_with_chr_vec.R renamed to R/gnrc_merge_with_chr_vec.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#' merge_with_chr_vec
2+
#' @description S4 Generic function to get the value of the slot merge_with_chr_vec
3+
#' @rdname merge_with_chr_vec-methods
4+
#' @param x An object
5+
#'
6+
#' @export
7+
8+
methods::setGeneric("merge_with_chr_vec", function(x) standardGeneric("merge_with_chr_vec"))
9+
#' merge_with_chr_vec
210
#' @name merge_with_chr_vec-ready4_local
311
#' @description Get the value of the slot merge_with_chr_vec for S4 objects of class ready4_local
412
#' @param x An object of class ready4_local
@@ -9,6 +17,15 @@ methods::setMethod("merge_with_chr_vec", methods::className("ready4_local"), fun
917
x@merge_with_chr_vec
1018
})
1119
#' merge_with_chr_vec<-
20+
#' @description S4 Generic function to set the value of the slot merge_with_chr_vec
21+
#' @rdname merge_with_chr_vec_set-methods
22+
#' @param x An object
23+
#' @param value Value to be assigned to x
24+
#'
25+
#' @export
26+
27+
methods::setGeneric("merge_with_chr_vec<-", function(x, value) standardGeneric("merge_with_chr_vec<-"))
28+
#' merge_with_chr_vec<-
1229
#' @name merge_with_chr_vec<--ready4_local
1330
#' @description Set the value of the slot merge_with_chr_vec for S4 objects of class ready4_local
1431
#' @param x An object of class ready4_local

R/gs_save_type.R renamed to R/gnrc_save_type.R

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
#' save_type
2+
#' @description S4 Generic function to get the value of the slot save_type
3+
#' @rdname save_type-methods
4+
#' @param x An object
5+
#'
6+
#' @export
7+
8+
methods::setGeneric("save_type", function(x) standardGeneric("save_type"))
9+
#' save_type
210
#' @name save_type-ready4_local_raw
311
#' @description Get the value of the slot save_type for S4 objects of class ready4_local_raw
412
#' @param x An object of class ready4_local_raw
@@ -9,6 +17,15 @@ methods::setMethod("save_type", methods::className("ready4_local_raw"), function
917
x@save_type
1018
})
1119
#' save_type<-
20+
#' @description S4 Generic function to set the value of the slot save_type
21+
#' @rdname save_type_set-methods
22+
#' @param x An object
23+
#' @param value Value to be assigned to x
24+
#'
25+
#' @export
26+
27+
methods::setGeneric("save_type<-", function(x, value) standardGeneric("save_type<-"))
28+
#' save_type<-
1229
#' @name save_type<--ready4_local_raw
1330
#' @description Set the value of the slot save_type for S4 objects of class ready4_local_raw
1431
#' @param x An object of class ready4_local_raw

0 commit comments

Comments
 (0)