Re: [R] (no subject)

From: <rex.dwyer_at_syngenta.com>
Date: Tue, 15 Mar 2011 13:03:15 -0400

Hi Jon, I read your question differently. Is the answer? - Rex

> ch=scan(stdin(),what=character(0),n=1)
1: f
Read 1 item
> ch

[1] "f"
>

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Bert Gunter Sent: Tuesday, March 15, 2011 10:09 AM
To: Jonathan P Daily
Cc: r-help_at_r-project.org
Subject: Re: [R] (no subject)

?strsplit

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.

Cheers,
Bert

On Tue, Mar 15, 2011 at 6:35 AM, Jonathan P Daily <jdaily_at_usgs.gov> wrote:
> I was wondering if there is a way to get read in a single keystroke at a
> 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 of an
> end of line. Has anyone ever had need to do this or have any ideas on how
> to do this?
>
> Thanks,
> Jon
>
> PS I apologize if this double-sends, but I am having mail client issues.
> --------------------------------------
> 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 it."
> - 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 http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
Bert Gunter
Genentech Nonclinical Biostatistics

______________________________________________
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.




message may contain confidential information. If you are not the designated recipient, please notify the sender immediately, and delete the original and any copies. Any use of the message by you is prohibited. 
______________________________________________
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.
Received on Tue 15 Mar 2011 - 17:06:22 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Mar 2011 - 17:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive