length(unlist(strsplit(C, ' '))) 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Shubha 
> Vishwanath Karanth
> Sent: Wednesday, April 09, 2008 11:21 AM
> To: [EMAIL PROTECTED]
> Subject: [R] Number of words in a string
> 
> Hi R,
> 
>  
> 
> A quick question: How do we find the number of words in a string?
> 
>  
> 
> Example:
> 
> C="Have a nice day"
> 
>  
> 
> And the number of words should be 4. any built in function or?...
> 
>  
> 
> Thanks, Shubha
> 
> Shubha Karanth | Amba Research
> 
> Ph +91 80 3980 8031 | Mob +91 94 4886 4510 
> 
> Bangalore * Colombo * London * New York * San Josi * 
> Singapore * www.ambaresearch.com
> 
>  
> 
> This e-mail may contain confidential and/or privileged 
> i...{{dropped:13}}
> 
>

______________________________________________
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