search for: shadvector

Displaying 1 result from an estimated 1 matches for "shadvector".

Did you mean: hasvector
2009 Apr 10
3
Determine the Length of the Longest Word in a String
...culate the length of that longest element. I was hoping to find a way to simply return the length of the longest word in a more straightforward way. Short sample code -- > shadstr <- c("My string of words with varying lengths. Longest word is nine - 1 22 333 999999999 4444") > shadvector <- unlist(strsplit(shadstr, split=" ")) > shadvlength <- lapply(shadvector,nchar) > shadmaxind <- which.max(shadvlength) ## Maximum element > shadmax <- nchar(shadvector[shadmaxind]) > shadmax [1] 9 Many thanks for your help and suggestions. Shad [[alternative H...