[R] splitting word

John Fox jfox at mcmaster.ca
Wed Mar 24 17:56:53 CET 2010


Dear Phoebe,

If I understand correctly that you always want to split a word into
individual letters, then strsplit("AA", "")[[1]] will do the trick -- and
help.search("split") turns up strsplit().

I hope this helps,
 John

--------------------------------
John Fox
Senator William McMaster 
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of phoebe kong
> Sent: March-24-10 12:46 PM
> To: r-help
> Subject: [R] splitting word
> 
> Hi all,
> 
> Could someone tell me how to split a word.
> 
> c("AA")
> 
> to
> 
> c("A","A")
> 
> Thanks!
> 
> Phoebe
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.



More information about the R-help mailing list