Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How do I run a for loop on multiple word files in R

$
0
0

I have 44 doc files. From each file, i need to extract the customer name and amount. I am able to this for one file using the read_document command and using the grep to extract the amount and customer name. When I do this for 44 files, I am getting error. Not sure where I am wrong:

ls()
rm(list = ls())
files <- list.files("~/experiment", ".doc")
files
length(files)
for (i in length(files)){
  library(textreadr)
  read_document(files[i])
  }

Viewing all articles
Browse latest Browse all 201839

Trending Articles