Skip to content
Prev 274171 / 398506 Next

strsplit question

On Wed, Oct 12, 2011 at 1:20 AM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
Try this:
[1] "5600" "6100" "9700" "9400" "8300"
[1] "5699" "6199" "9799" "9499" "8399"

and here is another approach:
[,1]   [,2]   [,3]   [,4]   [,5]
[1,] "5600" "6100" "9700" "9400" "8300"
[2,] "5699" "6199" "9799" "9499" "8399"

Now m[1, ] and m[2, ] are the vectors of digits before and after the
dash.  Note that c in the strapply call can be replaced with
as.numeric if you want a numeric matrix instead.