Skip to content

Commit

Permalink
update filepath to download to be compatible with MAC
Browse files Browse the repository at this point in the history
  • Loading branch information
hazelvaq committed Oct 2, 2024
1 parent 26ca32b commit 5c0ea59
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions R/manage_lib.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ check_lib <- function(type = c("derivative", "nobaseline", "raw", "mediod",
#' @importFrom utils read.csv download.file sessionInfo
#'
#' @export

get_lib <- function(type = c("derivative",
"nobaseline",
"raw",
Expand All @@ -189,27 +190,27 @@ get_lib <- function(type = c("derivative",

if("derivative" %in% type){
message("Fetching derivative library...")
download.file("https://osf.io/download/2qbkt/", destfile = paste0(lp, "\\derivative.rds"), mode = "wb")
download.file("https://osf.io/download/2qbkt/", destfile = file.path(lp, "derivative.rds"), mode = "wb")
}

if("nobaseline" %in% type){
message("Fetching nobaseline library...")
download.file("https://osf.io/download/jy7zk/", destfile = paste0(lp, "\\nobaseline.rds"), mode = "wb")
download.file("https://osf.io/download/jy7zk/", destfile = file.path(lp, "nobaseline.rds"), mode = "wb")
}

if("medoid" %in% type){
message("Fetching mediod library...")
download.file("https://osf.io/download/yzscg/", destfile = paste0(lp, "\\mediod.rds"), mode = "wb")
download.file("https://osf.io/download/yzscg/", destfile = file.path(lp, "mediod.rds"), mode = "wb")
}

if("model" %in% type){
message("Fetching model library...")
download.file("https://osf.io/download/v2yr3/", destfile = paste0(lp, "\\model.rds"), mode = "wb")
download.file("https://osf.io/download/v2yr3/", destfile = file.path(lp, "model.rds"), mode = "wb")
}

if("raw" %in% type){
message("Fetching raw library...")
download.file("https://osf.io/download/kzv3n/", destfile = paste0(lp, "\\raw.rds"), mode = "wb")
download.file("https://osf.io/download/kzv3n/", destfile = file.path(lp, "raw.rds"), mode = "wb")
}

message("Use 'load_lib()' to load the library")
Expand All @@ -227,6 +228,7 @@ load_lib <- function(type, path = "system") {
chk <- .chkf(type, path = lp, condition = "stop")

fp <- file.path(lp, paste0(type, ".rds"))

rds <- readRDS(fp)

return(rds)
Expand Down

0 comments on commit 5c0ea59

Please sign in to comment.