Does Console impose an upper limit on the length of strings

,

This is a limit of the console. it is mentioned in R documentation

Command lines entered at the console are limited4 to about 4095 bytes (not characters).

It seems to be hard coded in the source code

You can circumvent this by creating your string in a script then sourcing it or by creating it by pieces and pasting all in last step.

Example of creating programmatically a 5000 length string

test <- paste0(sample(letters, size = 5000, replace = TRUE), collapse = "")
stringr::str_length(test)
#> [1] 5000
4 Likes