Skip to content

Multi-line code not running with R. #1602

@mcwayrm

Description

@mcwayrm

Describe the bug
When I go to run an R script in vscode, I am able to run line which span only a single line. But if it spans a second line (e.g., a command inside ( ) or using +) I am unable to complete the command. I just got a new computer and am able to perform this with the same setup on a Dell Windows 10, but somehow I have issues with an LG Windows 11. The vscode environment is identically set up.

For example, I can import the data but I am unable to run this regression:

# Load data 
df <- setDT(import(path_data))
# Run Regression
col1 <- plm(publish ~ low + exlow + exhigh + field + phd + unilow + pval, 
                data = df,
                index = c("id", "vignette"), 
                model = "within")

Rather, I get the following error message:

Image

I have checked my settings.json and I believe everything should be in order:

"r.rpath.windows": "C:\\Program Files\\R\\R-4.4.3\\bin\\x64\\R.exe",
"r.rterm.windows": "c:\\Users\\user\\miniforge3\\envs\\env\\Scripts\\radian.exe",
"r.libPaths": [
    "C:\\Program Files\\R\\R-4.4.3\\library"
    ],
"r.plot.useHttpgd": true,
"r.bracketedPaste": true

To Reproduce
Taking any command I will be able to complete the first line but not the second line within vscode:

# Data 
data <- cars
# Works
reg1 <- lm(speed ~ dist , data = data)
# Does not work 
reg2 <- lm(speed ~ dist , 
                  data = data)

Can you fix this issue by yourself? (We appreciate the help)

No

Expected behavior
I expect both commands to run regardless if I press enter and move part of the command to the next line.

Environment (please complete the following information):

  • OS: Windows 11
  • VSCode Version: 1.99.3
  • R Version: 4.4.3
  • vscode-R version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions