I read the text file with below data and am trying to convert it to a dataframe
Id: 1
ASIN: 0827229534
title: Patterns of Preaching: A Sermon Sampler
group
EDIT: Correcting my answer.
Using stringr
:
library(stringr)
ids <- str_extract(text, 'Id:[ ]*\\S+')
ASIN <- str_extract(text, 'ASIN:[ ]*\\S+')
title <- str_extract(text, 'title:[ ]*\\S+')
group <- str_extract(text, 'group:[ ]*\\S+')
similar <- str_extract(text, 'similar:[ ]*\\S+')
rating <- str_extract(text, 'avg rating:[ ]*\\S+')