An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130603/8a7233e3/attachment.pl>
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:
Hello Dear R-help Members, I have noticed that when pasting text with "tab" in it to the R console it eliminates the tab. Whereas, when pasted into the R Editor, the tab is preserved. For example, pasting this: "1997 7680" In the R Console will result in: "19977680" Is there a way to preserve the tab? This would allow (for example) to use read.table with a table copied from website/libre-office/excel such as: a = read.table( text= " 1 2 3 4 ") a I understand I can use readClipboard directly, but I wonder if there is a way to use it while the text is kept in the R Editor. With regards, Tal
Sarah Goslee http://www.functionaldiversity.org
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130603/103dd4c0/attachment.pl>
On Mon, Jun 3, 2013 at 9:24 AM, Tal Galili <tal.galili at gmail.com> wrote:
My apologies Sarah, you are right, here: sessionInfo() R version 3.0.0 (2013-04-03) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=Hebrew_Israel.1255 LC_CTYPE=Hebrew_Israel.1255 LC_MONETARY=Hebrew_Israel.1255 [4] LC_NUMERIC=C LC_TIME=Hebrew_Israel.1255 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plyr_1.8 jpeg_0.1-4 loaded via a namespace (and not attached): [1] tools_3.0.0
Try this:
read.delim("clipboard")
On Jun 3, 2013, at 15:22 , Sarah Goslee wrote:
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.
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
Sarah On Mon, Jun 3, 2013 at 9:15 AM, Tal Galili <tal.galili at gmail.com> wrote:
Hello Dear R-help Members, I have noticed that when pasting text with "tab" in it to the R console it eliminates the tab. Whereas, when pasted into the R Editor, the tab is preserved. For example, pasting this: "1997 7680" In the R Console will result in: "19977680" Is there a way to preserve the tab? This would allow (for example) to use read.table with a table copied from website/libre-office/excel such as: a = read.table( text= " 1 2 3 4 ") a I understand I can use readClipboard directly, but I wonder if there is a way to use it while the text is kept in the R Editor. With regards, Tal
-- Sarah Goslee http://www.functionaldiversity.org
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Peter Dalgaard, Professor Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
On 03/06/2013 14:48, peter dalgaard wrote:
On Jun 3, 2013, at 15:22 , Sarah Goslee wrote:
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.
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.
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.
-pf
Sarah On Mon, Jun 3, 2013 at 9:15 AM, Tal Galili <tal.galili at gmail.com> wrote:
Hello Dear R-help Members, I have noticed that when pasting text with "tab" in it to the R console it eliminates the tab. Whereas, when pasted into the R Editor, the tab is preserved. For example, pasting this: "1997 7680" In the R Console will result in: "19977680" Is there a way to preserve the tab? This would allow (for example) to use read.table with a table copied from website/libre-office/excel such as: a = read.table( text= " 1 2 3 4 ") a I understand I can use readClipboard directly, but I wonder if there is a way to use it while the text is kept in the R Editor. With regards, Tal
-- Sarah Goslee http://www.functionaldiversity.org
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130603/5f8ae6c2/attachment.pl>
On Jun 3, 2013, at 12:46 PM, Tal Galili wrote:
Very interesting, thank you.
However, after disabling the tab completion, the RGUI still can't
distinguish pasted tabs. e.g:
# Running:
Sys.setenv(R_COMPLETION=FALSE)
Sys.getenv("R_COMPLETION")
a = read.table( text=
"
1 2
3 4
")
a
# will result in: (instead of two columns)
V1
1 12
2 34
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")
read.table(text="12
+ 34
+ "read.delim("12
Error: unexpected symbol in:
"34
"read.delim"
34")
+ + However with this in the GUI Editor: test <- read.table(text="1 2 3 4") Running this succeeds:
source(file(description="clipboard")) test
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.
David. > > > > > > ----------------Contact > Details:------------------------------------------------------- > Contact me: Tal.Galili at gmail.com | > Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | > www.r-statistics.com (English) > ---------------------------------------------------------------------------------------------- > > > > On Mon, Jun 3, 2013 at 5:11 PM, Prof Brian Ripley <ripley at stats.ox.ac.uk>wrote: > >> On 03/06/2013 14:48, peter dalgaard wrote: >> >>> >>> On Jun 3, 2013, at 15:22 , Sarah Goslee wrote: >>> >>> 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. >>>> >>> >>> 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. >>> >> >> 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. >> >> >> >> -pf >>> >>> >>>> Sarah >>>> >>>> On Mon, Jun 3, 2013 at 9:15 AM, Tal Galili <tal.galili at gmail.com> wrote: >>>> >>>>> Hello Dear R-help Members, >>>>> >>>>> I have noticed that when pasting text with "tab" in it to the R console >>>>> it >>>>> eliminates the tab. Whereas, when pasted into the R Editor, the tab is >>>>> preserved. >>>>> For example, pasting this: >>>>> "1997 7680" >>>>> In the R Console will result in: >>>>> "19977680" >>>>> >>>>> Is there a way to preserve the tab? >>>>> This would allow (for example) to use read.table with a table copied >>>>> from >>>>> website/libre-office/excel such as: >>>>> >>>>> a = read.table( text= >>>>> " >>>>> 1 2 >>>>> 3 4 >>>>> ") >>>>> a >>>>> >>>>> I understand I can use readClipboard directly, but I wonder if there is >>>>> a >>>>> way to use it while the text is kept in the R Editor. >>>>> >>>>> >>>>> With regards, >>>>> Tal >>>>> >>>> David Winsemius Alameda, CA, USA