[R-SIG-Mac] reading from clipboard error
Ken knoblauch
ken.knoblauch at inserm.fr
Mon Mar 19 10:09:20 CET 2012
Mark Cowley <m.cowley <at> garvan.org.au> writes:
> However, If you don't have a trailing newline,
the last line is silently skipped. Note
> readLines(warn=TRUE)'s doesn't produce a waning,
thus I think it doesn't even see the final line.
>
> Simple example:
> Select the letters with or without a trailing new line,
copy to clipboard, then
> A
> B
> C
> D
>
> # without trailing newline
> readLines(pipe("pbpaste"))
> [1] "A" "B" "C"
> # with trailing newline
> readLines(pipe("pbpaste"))
> [1] "A" "B" "C" "D"
I can replicate this with readLines if I stop
the blocking right after the D but not if
I take the whole line.
I don't get it though with either read.table or scan
> readLines(pipe("pbpaste"))
[1] "A" "B" "C"
> read.table(pipe("pbpaste"))
V1
1 A
2 B
3 C
4 D
Warning message:
In read.table(pipe("pbpaste")) :
incomplete final line found by readTableHeader on 'pbpaste'
> scan(pipe("pbpaste"), what = "character")
Read 4 items
[1] "A" "B" "C" "D"
> cheers,
> Mark
> -----------------------------------------------------
> Mark Cowley, PhD
>
> Pancreatic Cancer Program | Peter Wills Bioinformatics Centre
> Garvan Institute of Medical Research, Sydney, Australia
> -----------------------------------------------------
--
Ken Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html
More information about the R-SIG-Mac
mailing list