docx_summary(content) You should read documentation e.g. ?docx_summary and check the examples section
On Sat, Dec 30, 2023 at 2:12 PM Andy <phaedr...@gmail.com> wrote: > 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 > library(tcltk) > library(tidyverse) > library(officer) > > filepath <- setwd(tk_choose.dir()) > > filename <- "Now they want us to charge our electric cars from litter > bins.docx" > #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 > suggestion > if (!file.exists(full_filename)) { > message("File missing") > } else { > content <- read_docx(full_filename) > docx_summary() > # 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 > > head(content) > } > > > 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]] ______________________________________________ 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.