Closed meowcat closed 7 years ago
Thanks for reporting this! :+1:
Not sure if you're aware, but in R there are no scalars. So "bcdef" == c("bcdef")
is TRUE
.
I can understand wanting the prettier output but I don't really understand the need for outputting single strings. What is the context you need this in?
If you're chasing an easy way to quote strings, RStudio will do this if you highlight some text and press "
. Unfortunately it has the same \
(un)escaping bug. :roll_eyes:
Not sure if you're aware, but in R there are no scalars. So "bcdef" == c("bcdef") is TRUE.
Yes, I do know that, it's purely optical. No biggie, anyway.
I can understand wanting the prettier output but I don't really understand the need for outputting single strings. What is the context you need this in?
One of my main pasting "issues" is pasting Windows paths. Hence the issue with backslashes. There is another RStudio addin that solves this more specifically (https://github.com/sfr/RStudio-Addin-Snippets - however their solution is to reverse the backslashes, not escaping them). But if I had the choice I would go for a one-stop solution that solves both path escaping and paste-as-array, paste-as-dataframe.
So for purely optical reasons I would like single strings to be pasted without the c()
, but it's no huge issue.
I've fixed the handling of backslashes but left the output of length 1 vectors the same. I can see some value in having consistent behaviour.
thanks!
Current datapasta has issues with text containing backslashes.
Copying
\\my-server\DATA\libraries
and pasting with "paste as vector" givesc("\\my-server\DATA\libraries")
which on execution givesError: '\D' is an unrecognized escape in character string starting ""\\my-server\D"
I think it can be fixed by using
deparse()
.By the way, would you consider having a length-one array paste as a scalar instead of vector? Or is this against your design ideas?
i.e. such that copying
bcdef
and pasting would result in"bcdef"
instead ofc("bcdef")
.