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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Bert Gunter
Sent: Tuesday, March 15, 2011 10:09 AM
To: Jonathan P Daily
Cc: r-help@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 <jda...@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@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@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@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.

Reply via email to