Skip to content

Why do tabs disappear when pasted into the R console?

8 messages · Sarah Goslee, Tal Galili, Gabor Grothendieck +3 more

#
Pasting tabs into the console works for me on linux, which suggests
that you need to provide more information about your OS and all the
other usual things.

Sarah
On Mon, Jun 3, 2013 at 9:15 AM, Tal Galili <tal.galili at gmail.com> wrote:

  
    
#
On Mon, Jun 3, 2013 at 9:24 AM, Tal Galili <tal.galili at gmail.com> wrote:
Try this:

read.delim("clipboard")
#
On Jun 3, 2013, at 15:22 , Sarah Goslee wrote:

            
Which console and which Linux?

Anyways, the thing that usually gets in the way is tab-completion. If you expect pasting to work exactly as if the same characters were typed at the keyboard, you can't really expect that TAB will not try to autocomplete commands and filenames. I don't know whether there's a way to temporarily disable completion.

-pf

  
    
#
On 03/06/2013 14:48, peter dalgaard wrote:
There are lots of consoles and completion mechanisms.  But on RGui (at 
least this seems to be Windows), this is controlled by the environment 
variable R_COMPLETION and that can be set during a session.  Its help says

      ?R_COMPLETION?: Optional.  If set to ?FALSE?, command-line
           completion is not used.  (Not used by Mac OS GUI.)

and ??completion gets you there.

  
    
#
On Jun 3, 2013, at 12:46 PM, Tal Galili wrote:

            
I get the same result pasting fromExcel into RGUI in WinXP with tab-completion disabled. 

But I hope it is not forgotten that?.

 ?? six hours ago Gabor Grothendieck suggested:

read.delim("clipboard")

I do agree that is is strange but I find that the using (R 2.15.1/WinXP in VMware Fusion virtual box) R GUI editor  will not pass the tabs it recognizes (as signified by the appearance of a 7 character wide gap and the cursor jumping back)  along with source()-ed text when used with the Edit/Run selection menu choice:

read.delim("1	2
3	4")
+ 34
+ "read.delim("12
Error: unexpected symbol in:
"34
"read.delim"
+ 
+ 
However with this in the GUI Editor:

test <- read.table(text="1	2
3	4")

Running this succeeds:
V1 V2
1  1  2
2  3  4

So in Windows whatever connection the GUI is using when text from the clipboard is pasted, it somehow removes the tabs it encounters, unlike the connection used by 'source()' when accessing the clipboard file.