I am using Rstudio (2024.12.1 Build 563 "Kousa Dogwood" Release (27771613, 2025-02-02) for windows). If I source a file helper_functions.R
using this code:
helper_function_path <- "/path_to/helper_functions.R"
source(helper_function_path)
and then highlight a function name and press F2, "the code is displayed in a special Source Viewer pane which is read-only" ():
However, if I then make a copy of helper_functions.R
using this code:
dir_out <- "tmp"
if(!dir.exists(dir_out)) dir_out %>% dir.create(recursive = TRUE)
fn <- helper_function_path %>% basename()
fp <- fn %>% file.path(dir_out, .)
if(file.exists(fp)) file.remove(fp)
helper_function_path %>% file.copy(fp)
the next time I highlight a function name and press F2, RStudio opens (and allows me to edit) the copied file ./tmp/helper_functions.R
, not the original file /path_to/helper_functions.R
:
I have three questions:
- Is this behavior expected?
- Is there a way to copy
helper_functions.R
without causing F2 to open the copied file? - Is there a way to cause F2 to open the original file?
Thanks!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744375286a4571156.html
评论列表(0条)