Skip to content
Prev 279088 / 398506 Next

Counting the occurences of a charater within a string

strsplit is certainly an alternative, but your approach is
unnecessarily complicated and inefficient. Do this, instead:

sapply(strsplit(x,"/"),length)-1

Cheers,
Bert
On Thu, Dec 1, 2011 at 7:44 PM, Florent D. <flodel at gmail.com> wrote: