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
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
matthew.pet...@gmail.com wrote:
Hi,
I have a dataframe that has
On Mon, Oct 25, 2010 at 12:53 PM, Matthew Pettis
matthew.pet...@gmail.com 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
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
On Mon, Oct 25, 2010 at 1:20 PM, Matthew Pettis
matthew.pet...@gmail.com 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
5 matches
Mail list logo