I have a large data file consisting of a single line of text. The format resembles
Cat 14 Dog 15 Horse 16
I\'d eventually like to get
Here is another approach
string <- readLines(textConnection(x)) string <- gsub("(\\d+)", "\\1\n", string, perl = TRUE) dat <- read.table(text = string, sep = "")