FredHutch / VISCtemplates

Tools for writing reproducible reports at VISC
Other
6 stars 2 forks source link

Tweaks and tests for adding visc_load_pdata() #148

Closed slager closed 5 months ago

slager commented 5 months ago
mayerbry commented 5 months ago

Hello,

I've had trouble using this function, most recently (12:30pm on 4/26) I sourced from here and ran the following

library(Caskey820)
Caskey820_bama <- visc_load_pdata(Caskey820_bama_bds, criteria = "5d3fe6542a3a6517bdb2dc9e6b644d74")

and got the following error:

Error in readChar(con, 5L, useBytes = TRUE) : cannot open the connection
In addition: Warning message:
In readChar(con, 5L, useBytes = TRUE) :
  cannot open compressed file '/Users/bmayer/Library/R/x86_64/4.3/library/Caskey820/data/Caskey820_bama_bds.rda', probable reason 'No such file or directory'

it's going to the wrong directory for my packages, should be: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Caskey820/data/Caskey820_bama_bds.rda from file.path(system.file(package = "Caskey820"), "data")

slager commented 5 months ago

@mayerbry Do you get the same error when you restart your R session and then do this?

remotes::install_github("FredHutch/VISCtemplates", ref = "dave")
library(VISCtemplates)
library(Caskey820)
Caskey820_bama <- visc_load_pdata(Caskey820_bama_bds, criteria = "5d3fe6542a3a6517bdb2dc9e6b644d74")

Also, what do you get for:

Sys.getenv("R_LIBS_USER")
slager commented 5 months ago

This should be a better way. Added some tests for it as well.

mayerbry commented 5 months ago

works fine in the update!

FYI:

Sys.getenv("R_LIBS_USER")
[1] "/Users/bmayer/Library/R/x86_64/4.3/library"