[R] Keyboard Input
Jonathan P Daily
jdaily at usgs.gov
Tue Mar 15 15:29:02 CET 2011
I apologize for being unclear in my original post. What I am trying to
achieve is to capture the stdin() connection and read in a single
keystroke - including arrow keys and the like - without having to have to
use the return key each time. My goal is to create a small UI for rapidly
looking through the results of a large simulation. As I think about it
more, though, it is probably going to be easier to dump the data into
files and look through it outside of R.
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
"Is the room still a room when its empty? Does the room,
the thing itself have purpose? Or do we, what's the word... imbue it."
- Jubal Early, Firefly
Bert Gunter <gunter.berton at gene.com> wrote on 03/15/2011 10:08:51 AM:
> [image removed]
> Re: [R] (no subject)
> Bert Gunter
> Jonathan P Daily
> 03/15/2011 10:08 AM
> x <- "ThisIsaString"
> y<- strsplit(x,"")
> This gives a list, which you can convert to a vector by unlist(y)
> Incidentally, you could have found out about strsplit via R's
> help.search("character string") (or similar) or even googling "R
> string function" . Please use R's native Help capabilities before
> posting to the list.
> (I will grant that the unlist() trick may not be that easy to find).
> Also, it's often worthwhile searching the Help archives first. Peter
> Dalgaard answered this same question here a day or two ago.
> On Tue, Mar 15, 2011 at 6:35 AM, Jonathan P Daily <jdaily at usgs.gov>
> > I was wondering if there is a way to get read in a single keystroke at
> > time in R as a string, akin to ncurses-style interfaces. I looked into
> > readLines, readChar, etc. using stdin, but these all require the use
> > end of line. Has anyone ever had need to do this or have any ideas on
> > to do this?
> > Thanks,
> > Jon
> > PS I apologize if this double-sends, but I am having mail client
> > --------------------------------------
> > Jonathan P. Daily
> > Technician - USGS Leetown Science Center
> > 11649 Leetown Road
> > Kearneysville WV, 25430
> > (304) 724-4480
> > "Is the room still a room when its empty? Does the room,
> > the thing itself have purpose? Or do we, what's the word... imbue
> > - Jubal Early, Firefly
> > ______________________________________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > and provide commented, minimal, self-contained, reproducible code.
> Bert Gunter
> Genentech Nonclinical Biostatistics
More information about the R-help