While in a gui (be it Windows gui or RStudio etc) I can use readLines
from a script with a known number of lines as seen below by specifying n=?
. What if I am unsure of the number of lines being read (i.e., I have a lot of lines and don't know n). How can I use readLines
in a gui (read from a script within not an outside file) without specifying n? If you don't supply n it appears readLines
keeps the connection open and keeps on reading lines. Hitting esc stops the function but no lines are read.
x <- readLines(n=4)
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
x
Here is a video demoing the specific problem I am asking.
This is particularly useful when a poster gives you data in an odd format like the set below and you want to read it in without counting all the rows:
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
EDIT Until this gets reopened and Dason can answer himself...
Dason suggests using ctrl + z and this works (at least on a Windows machine)