Closed eliocamp closed 4 months ago
Thanks for reporting @eliocamp . Can confirm the bug.
@b-rodrigues I think we best put it in R/sysdata.rda
.
From ?data
"...Use of data within a function without an envir argument has the almost always undesirable side-effect of putting an object in the user's workspace (and indeed, of replacing any object of that name already there). It would almost always be better to put the object in the current evaluation environment by data(..., envir = environment()). However, two alternatives are usually preferable, both described in the ‘Writing R Extensions’ manual.
For sets of data, set up a package to use lazy-loading of data.
For objects which are system data, for example lookup tables used in calculations within the function, use a file ‘R/sysdata.rda’ in the package sources or create the objects by R code at package installation time.
A sometimes important distinction is that the second approach places objects in the namespace but the first does not. So if it is important that the function sees mytable as an object from the package, it is system data and the second approach should be used. In the unusual case that a package uses a lazy-loaded dataset as a default argument to a function, that needs to be specified by ::, e.g., survival::survexp.us. "
Can you test with latest master?
With the latest master, I get a different object that is not found 😅
rix::rix(r_ver = "latest",
r_pkgs = NULL,
system_pkgs = NULL,
git_pkgs = NULL,
ide = "rstudio",
project_path = "../nixtest2/",
overwrite = TRUE,
print = TRUE)
#> Error in available_r(): object 'sysdata' not found
Created on 2024-06-24 with reprex v2.1.0
Bruno has just pushed a fix:
devtools::install_github("https://github.com/b-rodrigues, ref = "simplify_available_r")
This should work.
not quite yet
should be ok now
rix::rix:()
seems to fail if the package is not loaded:This seems to be an issue with
rix:::available_r()
. https://github.com/b-rodrigues/rix/blob/86fac584c4cf16f1d6cc89745caf81088b8ae7f8/R/available_r.R#L14