Skip to content
Prev 285035 / 398502 Next

readLines vs scan

On Sun, Feb 12, 2012 at 10:35 AM, Bert Gunter <gunter.berton at gene.com> wrote:
It depends on whether we need to retain the information regarding
which elements were on the same line or not.  In the first case we
retain that info and in the second case we lose it:
Read 2 items
Read 3 items
[[1]]
[1] 1 2

[[2]]
[1] 3 4 5
Read 5 items
[1] 1 2 3 4 5

If we did want to get back the info we lost in the last instance we
need to re-read it:
$`1`
[1] 1 2

$`2`
[1] 3 4 5