Re: [R] dataframe, transform, strsplit

2010-10-25 Thread Gabor Grothendieck
On Mon, Oct 25, 2010 at 1:20 PM, Matthew Pettis wrote: > Thanks Gabor and Jim, > Both solutions worked equally well for me (now I have an embarrassment of > riches for a solution :-) ). > Now that my main problem is solved, I am happy, but I was wondering if > anyone would care to comment as to wh

Re: [R] dataframe, transform, strsplit

2010-10-25 Thread Matthew Pettis
Thanks Gabor and Jim, Both solutions worked equally well for me (now I have an embarrassment of riches for a solution :-) ). Now that my main problem is solved, I am happy, but I was wondering if anyone would care to comment as to why my 'strsplit' solution doesn't behave the way I think it shoul

Re: [R] dataframe, transform, strsplit

2010-10-25 Thread Gabor Grothendieck
On Mon, Oct 25, 2010 at 12:53 PM, Matthew Pettis wrote: > Hi, > > I have a dataframe that has a column of vectors that I need to extract off > the character string before the first '.' character and put it into a > separate column.  I thought I could use 'strsplit' for it within > 'transform', but

Re: [R] dataframe, transform, strsplit

2010-10-25 Thread jim holtman
try this: > df have want 1 a.b.ca 2 d.e.fd 3 g.h.ig > df$get <- gsub("^([^.]+).*", "\\1", df$have) > df have want get 1 a.b.ca a 2 d.e.fd d 3 g.h.ig g On Mon, Oct 25, 2010 at 12:53 PM, Matthew Pettis wrote: > Hi, > > I have a dataframe that has a column of ve

[R] dataframe, transform, strsplit

2010-10-25 Thread Matthew Pettis
Hi, I have a dataframe that has a column of vectors that I need to extract off the character string before the first '.' character and put it into a separate column. I thought I could use 'strsplit' for it within 'transform', but I can't seem to get the right invocation. Here is a sample datafra