Re: [R] Split strings based on multiple patterns

2016-10-19 Thread Joe Ceradini
Thanks for the additional approach, Greg. I had success with Gabor's recommendation but will take a look at gsubfn as well. Joe On Wed, Oct 19, 2016 at 10:19 AM, Greg Snow <538...@gmail.com> wrote: > I would suggest looking at the strapply function in the gsubfn > package. That gives you more

Re: [R] Split strings based on multiple patterns

2016-10-19 Thread Greg Snow
I would suggest looking at the strapply function in the gsubfn package. That gives you more flexibility in specifying what to look for in the structure of the data, then extract only those pieces that you want. On Fri, Oct 14, 2016 at 5:16 PM, Joe Ceradini wrote: >

Re: [R] Split strings based on multiple patterns (plain text)

2016-10-15 Thread Joe Ceradini
Thank you David Wolfskill, David Winsemius, and Gabor! All very helpful and interesting fixes for the problem (compiled below)! Now I will see which one works best on the 944 rows that each have a cell of smooshed attributes...the attribute names should be the same in all the rows, if there is any

Re: [R] Split strings based on multiple patterns

2016-10-15 Thread Gabor Grothendieck
Replace newlines and colons with a space since they seem to be junk, generate a pattern to replace the attributes with a comma and do the replacement and finally read in what is left into a data frame using the attributes as column names. (I have indented each line of code below by 2 spaces so if

Re: [R] Split strings based on multiple patterns (plain text)

2016-10-15 Thread David Winsemius
> On Oct 14, 2016, at 6:53 PM, Joe Ceradini wrote: > > Hopefully this looks better. I did not realize gmail default was html. > > I have a dataframe with a column that has many field smashed together. > I need to split the strings in the column into separate columns

Re: [R] Split strings based on multiple patterns (plain text)

2016-10-14 Thread Joe Ceradini
should be strsplit(ugly, attributes) not strplit(ugly, attributes) On Fri, Oct 14, 2016 at 7:53 PM, Joe Ceradini wrote: > Hopefully this looks better. I did not realize gmail default was html. > > I have a dataframe with a column that has many field smashed together. >

[R] Split strings based on multiple patterns (plain text)

2016-10-14 Thread Joe Ceradini
Hopefully this looks better. I did not realize gmail default was html. I have a dataframe with a column that has many field smashed together. I need to split the strings in the column into separate columns based on patterns. Example of a string that needs to be split: ugly <- c("Water temp:14:

Re: [R] Split strings based on multiple patterns

2016-10-14 Thread David Winsemius
> On Oct 14, 2016, at 4:16 PM, Joe Ceradini wrote: > > Afternoon, > > I unfortunately inherited a dataframe with a column that has many fields > smashed together. My goal is to split the strings in the column into > separate columns based on patterns. > > Example of

[R] Split strings based on multiple patterns

2016-10-14 Thread Joe Ceradini
Afternoon, I unfortunately inherited a dataframe with a column that has many fields smashed together. My goal is to split the strings in the column into separate columns based on patterns. Example of what I'm working with: ugly <- c("Water temp:14: F Waterbody type:Permanent Lake/Pond: Water