It is now possible to paste data as formatted code in RStudio Server/Cloud, and ssh sessions. (Thanks Garrick Aden-Buie and Jon Harmon!)
There is no way to connect your local machine's clipboard to the R session running on a cloud instance. So datapasta
cannot work as per local usage.
What has been developed instead are two kinds of fallback behaviour that capture most of the magic!
If datapasta
detects the clipboard is not available and the editor is RStudio,
it will check to see if there is a text selection active (highlighted text).
Given a selection, it will read that text instead of the clipboard and proceed
as per the called function, e.g. attempt to parse that text as data and paste as
a tribble
if tribble_paste
was called.
The imagined workflow here is:
Again if there is no clipboard available, but in this case there is no text
selected in RStudio (or you're not in RStudio), datapasta
will open a
temporary file and then call utils::file.edit()
on it.
In RStudio server/cloud this will pop-up a modal text editor window where text
can be pasted. When the editor is closed, the text will be read by datapasta
and then things will proceed as if that data had come from the clipboard. The
temporary file is deleted immediately after being read.
If you're not in RStudio, but on the command line in an ssh session, this will open a command line text editor instead of the modal window.
The workflow in this case is:
The first time the pop-up text editor is about to be opened in each session,
datapasta
issues a message in a modal dialogue to explain what is about to
happen. This can be disabled with:
options(datapasta.quiet_manual_paste = TRUE)