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

2023-12-30 Thread Ivan Krylov
В Sat, 30 Dec 2023 12:18:52 + Andy пишет: > filepath <- setwd(tk_choose.dir()) Since you're using tcltk, you can get a file path in one step using tk_choose.files(). (Use multi = FALSE to choose only one file.) > full_filename <- paste(filepath, filename, sep="/") There's also file.path(),

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

2023-12-30 Thread Eric Berger
Sorry, I was being too quick. You have to pay attention to the pipe operator You were advised to do the following content <- read_docx(full_filename) |> docx_summary() which should have worked but I think you left out the |> operator. Alternatively tmp <- read_docx(full_filename) content <

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

2023-12-30 Thread Andy
An update: Running this block of code: # 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) full_filename <- paste(fil

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

2023-12-30 Thread Eric Berger
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 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

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

2023-12-30 Thread Andy
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) libr

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

2023-12-30 Thread Eric Berger
full_filename <- paste(filepath, filename,sep="/") On Sat, Dec 30, 2023 at 1:45 PM Andy wrote: > Thanks Ivan and Calum > > I continue to appreciate your support. > > Calum, I entered the code snippet you provided, and it returns 'file > missing'. Looking at this, while the object 'full_filename'

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

2023-12-30 Thread Andy
Good idea, El - thanks. The link is https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing&ouid=103065135255080058813&rtpof=true&sd=true This is helpful. From the article, which is typical of Lexis+ output, I want to extract the following fields and append to a

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

2023-12-30 Thread Andy
Thanks Ivan and Calum I continue to appreciate your support. Calum, I entered the code snippet you provided, and it returns 'file missing'. Looking at this, while the object 'full_filename' exists, what is happening is that the path from getwd() is being appended to the title of the article, b