8000 Adjust parse so that it can process Windows EOLs · Issue #124 · r-lib/evaluate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Adjust parse so that it can process Windows EOLs #124
Open
@sjentsch

Description

@sjentsch

Currently, parse_all (strictly speaking the evaluation of the parsed string) fails if x contains Windows EOL-markers (\r\n). In order to prevent this, this line

x <- unlist(strsplit(x, "\n"), recursive = FALSE, use.names = FALSE)
could be changed so that it accepts either \n or \r\n as split characters:
x <- unlist(strsplit(x, "\n|\r\n"), recursive = FALSE, use.names = TRUE)

I understand that this rarely would happen (R-functions generally handle Windows-EOLs correctly). The error may however occur if the syntax to be evaluated is copied from the clipboard. Another example where the error can occur is the jamovi module Rj (https://github.com/jonathon-love/Rj). I could also fix it there, but I thought it may be better to handle it in parse_all.

R-code for producing the error:
evaluate::evaluate(paste(readLines("https://raw.githubusercontent.com/sjentsch/examples4jamovi/main/Factor%20analysis/Syntax_CheckCorrelations.R"), collapse = "\r\n"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0