Is m[[1]] what you need? > On 14 Jul 2015, at 07:40, Alex Kim <dumboisveryd...@gmail.com> wrote: > > Hello, > > I am trying to create a matrix that looks like this, using the > stri_locate_all function. > >> x <- "ABCDJAKSLABCDAKJSABCD" >> m <- stri_locate_all_regex(x, 'ABCD') >> m > [[1]] > start end > [1,] 1 4 > [2,] 10 13 > [3,] 18 21 > > I tried converting m into a matrix, however it always seems to wrap around > the wrong way: > >> output <- matrix(unlist(m), ncol = 2, byrow = TRUE) >> output > [,1] [,2] > [1,] 1 10 > [2,] 18 4 > [3,] 13 21 > > I want to output the start locations in the first column and the end > locations in the second column into a matrix to look like this. > > [,1] [,2] > [1,] 1 4 > [2,] 10 13 > [3,] 18 21 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.