golem
golem copied to clipboard
cannot open file 'data-raw/config.yaml': No such file or directory with golem shiny app
hello all,
I am getting some error
cannot open file 'data-raw/config.yaml': No such file or directory
config.yaml is a file with paths, app version , variable renaming etc. which I have placed it into data-raw. I am not sure how to work with these types of files. This is where the repo is: https://github.com/gabrielburcea/gtdepmap/tree/devel_golem
TO NOTE: I did not work yet with modules, thus keep in mind, as I need to understand how complex is, will take it step by step , after I succeed runing the app the way I set it as of now, then I will add the modules.
Hey,
data-raw is supposed to contain the script to build the internal dataset, so this is not where you'll put your external resources.
In a golem app, if you have an external resource to include, you can add it to inst/
Then,
L inst/
L this.yaml
can be read with app_sys("this.yaml")
L inst/
L that /
L this.yaml
can be read with app_sys("that/this.yaml")
Hey Colin,
I have added the file to inst. And read it like this:
my_yaml = yaml::yaml.load_file(app_sys("inst/config.yaml"))
But I get an error:
Error: object 'path_to_bem' not found
In app_server path_to_bem isn't recognized although it is within config.yaml
in app_server , line 23, where the path_to_bem appears isn't recognised:
CCLECRISPRAchilles = data.frame(fread(file=file.path(path_to_bem,ccle_crispr_file_reldir), sep=","), row.names=1, check.names=F)
I have added the features of my own config.yaml to golem-config.yaml . Yet, I get warnings and errors when testing the package through build function:
Warning (test-golem-recommended.R:43:5): golem-config works
incomplete final line found on '/home/kkwf800/gtdepmap/inst/golem-config.yml'
Backtrace:
1. testthat::expect_false(...)
at test-golem-recommended.R:43:4
4. gtdepmap::get_golem_config("app_prod", config = "dev", file = config_file)
5. config::get(value = value, config = config, file = file, use_parent = use_parent)
at gtdepmap/R/app_config.R:38:2
6. yaml::yaml.load_file(file, eval.expr = FALSE, handlers = list(expr = function(x) parse(text = x)))
9. base::readLines(con, warn = readLines.warn)
Warning (test-golem-recommended.R:55:1): (code run outside of test_that())
cannot open file 'inst/golem-config.yaml': No such file or directory
Backtrace:
- shiny::testServer(...) at test-golem-recommended.R:55:0
- gtdepmap server(input = session$input, output = session$output, session = session)
- yaml::yaml.load_file("inst/golem-config.yaml") at gtdepmap/R/app_server.R:31:2
- base::readLines(con, warn = readLines.warn)
Error (test-golem-recommended.R:55:1): (code run outside of test_that())
Error: cannot open the connection
Backtrace:
- shiny::testServer(...) at test-golem-recommended.R:55:0
- gtdepmap server(input = session$input, output = session$output, session = session)
- yaml::yaml.load_file("inst/golem-config.yaml") at gtdepmap/R/app_server.R:31:2
- base::readLines(con, warn = readLines.warn)
I am reading here https://engineering-shiny.org/golem.html but I cannot see anything about where I can set my paths to the data directory that is external to the app package I am building.