[R] Help request: Parsing docx files for key words and appending to a spreadsheet

Andy ph@edru@v @end|ng |rom gm@||@com
Sat Dec 30 13:12:20 CET 2023

Hi Eric

Thanks for that. That seems to fix one problem (the lack of a 
separator), but introduces a new one when I complete the function Calum 
proposed:Error in docx_summary() : argument "x" is missing, with no default

The whole code so far looks like this:

# Load libraries

filepath <- setwd(tk_choose.dir())

filename <- "Now they want us to charge our electric cars from litter 
#full_filename <- paste0(filepath, filename) # Calum's original suggestion

full_filename <- paste(filepath, filename, sep="/") # Eric's proposed fix

#lets double check the file does exist! # The rest here is Calum's 
if (!file.exists(full_filename)) {
   message("File missing")
} else {
   content <- read_docx(full_filename)
   # this reads docx for the full filename and
   # passes it ( |> command) to the next line
   # which summarises it.
   # the result is saved in a data frame object
   # called content which we shall show some
   # heading into from


Running this, results in the error cited above.

Thanks as always :-)

On 30/12/2023 11:58, Eric Berger wrote:
> full_filename <- paste(filepath, filename,sep="/")

	[[alternative HTML version deleted]]

More information about the R-help mailing list