On Mon, 2007-10-15 at 12:04 -0400, Gonçalo Ferraz wrote:
> Hi,
>
> I have a vector of strings (class character) with 6 elements (length
> 6). I call it 'names'.
>
> "Graham Chapman"
> "John Cleese"
> "Terry Gilliam"
> "Eric Idle"
> "Terry Jones"
> "Michael Palin"
>
> And I want to turn it into
Lemon Curry ?
sapply( strsplit( monty, " " ), function(x) {
paste( substring(x,1,3), collapse = " " )
})
is a way to do it, ...
There is probably a better way to do that using the gsubfn package
Gonçalo Ferraz wrote:
> Hi,
>
> I have a vector of strings (class character) with 6 elements (leng
Hi,
I have a vector of strings (class character) with 6 elements (length
6). I call it 'names'.
"Graham Chapman"
"John Cleese"
"Terry Gilliam"
"Eric Idle"
"Terry Jones"
"Michael Palin"
And I want to turn it into another vector of strings called
'shortnames' with the same length.
The new vect
3 matches
Mail list logo