search for: shadstr

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

Did you mean: shader
2009 Apr 10
3
Determine the Length of the Longest Word in a String
...length of that particular word. My question -- It seems inefficient to determine which element is the longest and then calculate 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 > sha...