[R] (no subject)

Bert Gunter gunter.berton at gene.com
Tue Mar 15 15:08:51 CET 2011


?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



More information about the R-help mailing list