[R] parsing strings between [ ] in columns

2010-02-18 Thread milton ruser
Dear all, I have a data.frame with a column like the x shown below myDF-data.frame(cbind(x=c([[1, 0, 0], [0, 1]], [[1, 1, 0], [0, 1]],[[1, 0, 0], [1, 1]], [[0, 0, 1], [0, 1]]))) myDF x 1 [[1, 0, 0], [0, 1]] 2 [[1, 1, 0], [0, 1]] 3 [[1, 0, 0], [1, 1]] 4 [[0, 0, 1], [0,

Re: [R] parsing strings between [ ] in columns

2010-02-18 Thread Barry Rowlingson
On Thu, Feb 18, 2010 at 8:29 AM, milton ruser milton.ru...@gmail.com wrote: Dear all, I have a data.frame with a column like the x shown below myDF-data.frame(cbind(x=c([[1, 0, 0], [0, 1]],   [[1, 1, 0], [0, 1]],[[1, 0, 0], [1, 1]],   [[0, 0, 1], [0, 1]]))) myDF                    x 1

Re: [R] parsing strings between [ ] in columns

2010-02-18 Thread Barry Rowlingson
On Thu, Feb 18, 2010 at 8:29 AM, milton ruser milton.ru...@gmail.com wrote: Dear all, I have a data.frame with a column like the x shown below myDF-data.frame(cbind(x=c([[1, 0, 0], [0, 1]],   [[1, 1, 0], [0, 1]],[[1, 0, 0], [1, 1]],   [[0, 0, 1], [0, 1]]))) myDF After identify the groups

Re: [R] parsing strings between [ ] in columns

2010-02-18 Thread Gabor Grothendieck
Here is a solution using strapply in the gsubfn package. First we define a proto object p containing a single method, i.e. function, called fun. fun will take one [...] construct and split it into the numeric vector v using strsplit and will also assign it names. strapply has a built in