Skip to content

Commit

Permalink
fix of get pub fn
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewphamilton committed Jul 14, 2021
1 parent fce3213 commit 07c9db8
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 7 deletions.
11 changes: 8 additions & 3 deletions R/fn_get.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#' Get dataverse dataset publication
#' @description get_dv_ds_publication() is a Get function that retrieves a pre-existing data object from memory, local file system or online repository. Specifically, this function implements an algorithm to get dataverse dataset publication. Function argument ds_url_1L_chr specifies the where to look for the required object. The function returns Doi url (a character vector of length one).
#' @param ds_url_1L_chr Dataset url (a character vector of length one)
#' @param server_1L_chr Server (a character vector of length one), Default: 'dataverse.harvard.edu'
#' @param key_1L_chr Key (a character vector of length one), Default: NULL
#' @return Doi url (a character vector of length one)
#' @rdname get_dv_ds_publication
#' @export
#' @importFrom dataverse dataset_metadata
#' @importFrom dplyr filter pull
#' @importFrom purrr pluck
#' @keywords internal
get_dv_ds_publication <- function (ds_url_1L_chr)
get_dv_ds_publication <- function (ds_url_1L_chr, server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL)
{
ds_md_ls <- dataverse::dataset_metadata(ds_url_1L_chr)
ds_md_ls <- dataverse::dataset_metadata(ds_url_1L_chr, key = key_1L_chr,
server = server_1L_chr)
doi_url_1L_chr <- ds_md_ls$fields %>% dplyr::filter(typeName ==
"publication") %>% dplyr::pull(value) %>% purrr::pluck(1)
doi_url_1L_chr <- ifelse(!is.null(doi_url_1L_chr), doi_url_1L_chr %>%
Expand Down Expand Up @@ -416,7 +420,8 @@ get_ttu_dv_dss <- function (ttu_dv_nms_chr = "TTU", server_1L_chr = "dataverse.h
purrr::pluck(.x))$depnt_var_nm_1L_chr)), predrs_ls = list(get_predictors_lup(dv_dss_mdl_smrys_ls %>%
purrr::pluck(.x)) %>% dplyr::pull(long_name_chr)),
ds_url = names(ttu_dss_ls)[.x])) %>% dplyr::mutate(publication_url = purrr::map_chr(ds_url,
~get_dv_ds_publication(.x)))
~get_dv_ds_publication(.x, key_1L_chr = key_1L_chr,
server_1L_chr = server_1L_chr)))
ttu_dv_dss_tb <- ready4use::add_labels_from_dictionary(ttu_dv_dss_tb,
dictionary_tb = tibble::tibble(var_nm_chr = names(ttu_dv_dss_tb),
var_desc_chr = c("ID", "Utility", "Predictors",
Expand Down
12 changes: 9 additions & 3 deletions data-raw/fns/get.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
get_dv_ds_publication <- function(ds_url_1L_chr){
ds_md_ls <- dataverse::dataset_metadata(ds_url_1L_chr)
get_dv_ds_publication <- function(ds_url_1L_chr,
server_1L_chr = "dataverse.harvard.edu",
key_1L_chr = NULL){
ds_md_ls <- dataverse::dataset_metadata(ds_url_1L_chr,
key = key_1L_chr,
server = server_1L_chr)
doi_url_1L_chr <- ds_md_ls$fields %>%
dplyr::filter(typeName == "publication") %>%
dplyr::pull(value) %>% purrr::pluck(1)
Expand Down Expand Up @@ -316,7 +320,9 @@ get_ttu_dv_dss <- function(ttu_dv_nms_chr = "TTU",
dplyr::pull(long_name_chr)),
ds_url = names(ttu_dss_ls)[.x])) %>%
dplyr::mutate(publication_url = purrr::map_chr(ds_url,
~ get_dv_ds_publication(.x)))
~ get_dv_ds_publication(.x,
key_1L_chr = key_1L_chr,
server_1L_chr = server_1L_chr)))

ttu_dv_dss_tb <- ready4use::add_labels_from_dictionary(ttu_dv_dss_tb,
dictionary_tb = tibble::tibble(var_nm_chr = names(ttu_dv_dss_tb),
Expand Down
Binary file modified data/fns_dmt_tb.rda
Binary file not shown.
10 changes: 9 additions & 1 deletion man/get_dv_ds_publication.Rd

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

Binary file modified pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 07c9db8

Please sign in to comment.