While working in a reasonably long piece of analysis I have been running into the below error.
E5108: Lua: Vim:E482: Can't open file C:/Users/pottj/AppData/Local/Temp/R.nvim-pottj/Rsource-31656 for writing: no such file or directory
stack traceback:
[C]: in function 'writefile'
...pottj/AppData/Local/nvim-data/lazy/R.nvim/lua/r/send.lua:360: in function 'source_lines'
...pottj/AppData/Local/nvim-data/lazy/R.nvim/lua/r/send.lua:264: in function 'send_chunk_line'
...pottj/AppData/Local/nvim-data/lazy/R.nvim/lua/r/send.lua:752: in function 'line'
[string ":lua"]:1: in main chunk
This error occurs on long piped blocks of code but single lines of code could still be sent to ARF and ran without error. Long piped code blocks had worked prior to this section.
The code could be simpler, it has a structure like this:
code_pat <- "\\b[A-Z][0-9]{2}\\b"
old_mtcars <- mtcars |>
rownames_to_column("model") |>
mutate(
am = if_else(am == 1, "A01 B02", "C03"),
vs = if_else(vs == 1, "D04 E05", "F06")
)
new_mtcars <- mtcars |>
rownames_to_column("model") |>
mutate(
am = if_else(am == 1, "A01 G07", "H08"),
vs = if_else(vs == 1, "D04 I09", "J10")
)
combined_mtcars <- bind_rows(
old_mtcars |>
select(
cyl,
gear,
carb,
mpg,
hp,
am
) |>
distinct(),
new_mtcars |>
select(
cyl,
gear,
carb,
mpg,
hp,
am
) |>
distinct()
) |>
group_by(cyl, gear, carb) |>
reframe(
mpg = first(mpg),
hp = first(hp),
comb_am = {
txt <- paste(am, collapse = " ")
codes <- str_extract_all(txt, code_pat)[[1]]
codes <- codes[!duplicated(codes)]
if (length(codes) == 0) NA_character_ else paste(codes, collapse = " ")
}
) |>
distinct()
When I switched the R app to the R.exe directly (it's the same version installed via rig) the error does not persist.
The issue seemed to be exacerbated by locking the machine and returning to an active session, but did occur multiple times when working interactively. I typically need to restart nvim to gain a functional environment again. Restarting the whole machine did not solve the problem.
OS: windows 11
nvim: 12.2
R.nvim: 0.95 and 1.0
Terminal: wezterm
ARF: 0.4.3a
While working in a reasonably long piece of analysis I have been running into the below error.
This error occurs on long piped blocks of code but single lines of code could still be sent to ARF and ran without error. Long piped code blocks had worked prior to this section.
The code could be simpler, it has a structure like this:
When I switched the R app to the R.exe directly (it's the same version installed via rig) the error does not persist.
The issue seemed to be exacerbated by locking the machine and returning to an active session, but did occur multiple times when working interactively. I typically need to restart nvim to gain a functional environment again. Restarting the whole machine did not solve the problem.
OS: windows 11
nvim: 12.2
R.nvim: 0.95 and 1.0
Terminal: wezterm
ARF: 0.4.3a