You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When interactively developing in RStudio, I often might run selections of code by running line by line or highlighting a section to run with cmd + enter or the Run button. This occasionally generates errors when running box::use(local/module), even though the relative sourcing is correct. Below is an example with two modules a and b in the same directory:
a.R
#' Title#' @exporta<-function() {
print("I am a")
}
b.R
box::use(./a)
a$a()
If I open up b.R and highlight the code and run, it is successful:
However, if I leave the same code block highlighted, restart my R session, and click run without re-highlighting the code, it fails, indicating that it is unable to load module a in my current project directory.
However, clicking back on the b.R script and running line by line or re-highlighting will successfully run. With more complex modules with multiple imports, running code line by line can generate the same error, where it seems the RStudio pathing has lost track of the source file and defaults to project directory or base directory, depending if in a project environment or not.
I can explore a more complex reprex if helpful. This is not a critical bug, but something other colleagues have noticed so flagging here.
R version
_
platform x86_64-apple-darwin20
arch x86_64
os darwin20
system x86_64, darwin20
status
major 4
minor 3.3
year 2024
month 02
day 29
svn rev 86002
language R
version.string R version 4.3.3 (2024-02-29)
nickname Angel Food Cake
Thanks for the detailed error description! Unfortunately I am completely unable to reproduce this issue… I’ve attached a video where I am running your example as closely as I can reproduce it, including using an ‘renv’ environment.
Error description
When interactively developing in RStudio, I often might run selections of code by running line by line or highlighting a section to run with
cmd + enter
or theRun
button. This occasionally generates errors when runningbox::use(local/module)
, even though the relative sourcing is correct. Below is an example with two modulesa
andb
in the same directory:a.R
b.R
If I open up
b.R
and highlight the code and run, it is successful:However, if I leave the same code block highlighted, restart my R session, and click run without re-highlighting the code, it fails, indicating that it is unable to load module
a
in my current project directory.However, clicking back on the
b.R
script and running line by line or re-highlighting will successfully run. With more complex modules with multiple imports, running code line by line can generate the same error, where it seems the RStudio pathing has lost track of the source file and defaults to project directory or base directory, depending if in a project environment or not.I can explore a more complex reprex if helpful. This is not a critical bug, but something other colleagues have noticed so flagging here.
R version
RStudio version
‘box’ version
‘1.2.0’
The text was updated successfully, but these errors were encountered: