Search code examples
rtext-mining

How to convert dataframe from list with different number of rows in R?


I'm reading text data from many pdf files. I have object that is a list

list description

enter image description here As you can see, the elements differ in number of rows. I need to convert that into dataframe for text mining, but when I use function as.data.frame() it gives me an error:

as.data.frame(text_from_all_pdf)

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, : arguments imply differing number of rows: 353, 457, 101, 517, 74, 102, 57, 5, 93


Solution

  • Try unlisting text_from_all_pdf and create a dataframe with one column.

    data <- data.frame(text = unlist(text_from_all_pdf))