Re: [R] Number of words in a string

From: Shubha Vishwanath Karanth <shubhak_at_ambaresearch.com>
Date: Wed, 09 Apr 2008 20:57:04 +0530

To put in more general,

C=c("My Dog", "Its really good", "Beautiful")

And the resultant output should be
[1] 2 3 1

...the number of words....

Thank you...
Shubha Karanth | Amba Research
Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San Josť * Singapore * www.ambaresearch.com

-----Original Message-----
From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, April 09, 2008 8:51 PM
To: r-help_at_stat.math.ethz.ch
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 Josť * Singapore * www.ambaresearch.com  

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

This e-mail may contain confidential and/or privileged i...{{dropped:10}}



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 Wed 09 Apr 2008 - 15:59:42 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 Wed 09 Apr 2008 - 16:30:27 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