В Fri, 29 Dec 2023 20:17:41 +0000
Andy <phaedr...@gmail.com> пишет:

> doc_in <- read_docx(files)
> 
> Results in this error:Error in filetype %in% c("docx") && 
> grepl("^([fh]ttp)", file) :'length = 9' in coercion to 'logical(1)'

help(read_docx) says that the function only imports one docx file. In
order to read multiple files, use a for loop or the lapply function.

> content <- officer::docx_summary("Now they want us to charge our 
> electric cars from litter bins.docx") # A title of one of the articles
> 
> The error returned is:Error in x$doc_obj : $ operator is invalid for 
> atomic vectors

A similar problem here. help(docx_summary) says that the function
accepts "rdocx" objects returned by read_docx, not file paths. A string
in R is indeed an atomic vector of type character, length 1.

docx_summary(read_docx("Now they want us to charge our electric cars
from litter bins.docx")) should work.

-- 
Best regards,
Ivan

______________________________________________
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.

Reply via email to