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

2024-01-06 Thread Andy
uot;page"=pg, "length"=len) } # roll up the list to a data frame. Many ways to do this. myDF <- do.call("rbind",myList) # Hope that helps. Tim -- Date: Thu, 4 Jan 2024 12:59:59 + From: Andy To: r-help@r-pro

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

2024-01-04 Thread Andy
Hi folks Thanks for your help and suggestions - very much appreciated. I now have some working code, using this file I uploaded for public access: https://docs.google.com/document/d/1QwuaWZk6tYlWQXJ3WLczxC8Cda6zVERk/edit?usp=sharing&ouid=103065135255080058813&rtpof=true&sd=true The small c

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

2024-01-03 Thread Dr Eberhard Lisse
If you do something like this for i in $(pandoc --list-output-formats); do pandoc -f docx -t $i -o test.$i Now\ they\ want\ us\ to\ charge\ our\ electric\ cars\ from\ litter\ bins.docx; done you get approximately 65 formats, from which you can pick one wh

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

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

2023-12-29 Thread Dr Eberhard W Lisse
Andy, you can always open a public Dropbox or Google folder and post the link. el On 29/12/2023 22:37, Andy wrote: > Thanks - I'll have a look at these options too. > > I'm happy to send over a sample document, but wasn't aware if > attachments are allowed. The documents come Lexis+, so require

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

2023-12-29 Thread CALUM POLWART
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. > I told you people will suggest better ways to loop!! > > docx_summary(read_docx("Now they want us to charge our electric cars > from litter bins.docx"))

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

2023-12-29 Thread Ivan Krylov
В Fri, 29 Dec 2023 20:17:41 + Andy пишет: > 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 mul

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

2023-12-29 Thread Andy
Thanks - I'll have a look at these options too. I'm happy to send over a sample document, but wasn't aware if attachments are allowed. The documents come Lexis+, so require user credentials to log in, but I could upload the file somewhere if that would help? Any ideas for a good location to do

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

2023-12-29 Thread Dr Eberhard W Lisse
I would also look at https://pandoc.org perhaps which can export a number of formats... And for spreadsheets https://github.com/jqnatividad/qsv is my goto weapon. Can also read and write XLSX and others. A sample document or two would always be helpful... el On 29/12/2023 21:01, CALUM POLWART

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

2023-12-29 Thread Andy
Hi Roy (& others) Many thanks for the advice - well taken. Thanks also to the others who have responded so quickly - I thought I might have to wait days!! :-) I'm on a Linux (Mint) machine. Below, I document three attempts, two using officer and the last now using textreadr My attempts so far

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

2023-12-29 Thread CALUM POLWART
It sounded like he looked at officeR but I would agree content <- officer::docx_summary("filename.docx") Would get the text content into an object called content. That object is a data.frame so you can then manipulate it. To be more specific, we might need an example of the DF You can loop thi

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

2023-12-29 Thread CALUM POLWART
textreadr would be the obvious approach. When you say it is depreciated do you mean it's not available on cran? Sometimes maintaining a package on cran in just a pain in the ass. devtools::install_github("trinker/textreadr") Should let you install it. In theory docx files are actually just zip

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

2023-12-29 Thread jim holtman
checkout the 'officer' package Thanks Jim Holtman *Data Munger Guru* *What is the problem that you are trying to solve?Tell me what you want to do, not how you want to do it.* On Fri, Dec 29, 2023 at 10:14 AM Andy wrote: > Hello > > I am trying to work through a problem, but feel like I've

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

2023-12-29 Thread Roy Mendelssohn - NOAA Federal via R-help
Hi Andy: I don’t have an answer but I do have what I hope is some friendly advice. Generally the more information you can provide, the more likely you will get help that is useful. In your case you say that you tried several packages and they didn’t do what you wanted. Providing that code,

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

2023-12-29 Thread Andy
Hello I am trying to work through a problem, but feel like I've gone down a rabbit hole. I'd very much appreciate any help. The task: I have several directories of multiple (some directories, up to 2,500+) *.docx files (newspaper articles downloaded from Lexis+) that I want to iterate throug

Re: [R] Help request from Ph.D. Students

2016-01-11 Thread Mohammed Ouassou
Try DLM package : dlm: Bayesian and Likelihood Analysis of Dynamic Linear Models M.O On Mon, 2016-01-11 at 13:07 +0100, Franklin Bretschneider wrote: > Dear NECMETTİN ALPAY KOÇAK, > > Re: > > > Dear All, > > I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on > > a Ti

Re: [R] Help request from Ph.D. Students

2016-01-11 Thread Franklin Bretschneider
Dear NECMETTİN ALPAY KOÇAK, Re: > Dear All, > I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on a > Time Series" which R has already a nice package, namely "Filter". This > package is really helpful for my study. But, I really help from you to create > two filter usi

[R] Help request from Ph.D. Students

2016-01-10 Thread NECMETTİN ALPAY KOÇAK
Dear All, I am Ph.D. student in Econometrics. My thesis is about "Linear Filtering on a Time Series" which R has already a nice package, namely "Filter". This package is really helpful for my study. But, I really help from you to create two filter using with "filter" package. I want to create t

Re: [R] R -HELP REQUEST

2013-02-05 Thread Rolf Turner
If you just want point forecasts, it's simple: Let your original series be X_t, t=1, ..., N. Let Y_t = log(X_t). Let Z_t = Y_t - Y_{t-1}, t = 2, ..., N. Fit your model and forecast, obtaining Z-hat__1, ..., Z-hat_10. Then Y-hat_{N+1} = Y_N + Z-hat_1, Y-hat_{N+2} = Y-hat_{N+1} + Z-hat_2, .,

[R] R -HELP REQUEST

2013-02-05 Thread Mahmoud Coker
Good morning to you all, Sorry for taking your time from your research and teaching schedules.   If you have a non-stationary univariate time Series data that has the transformation: Say; l.dat<-log (series) d.ldat<-diff (l.dat, differences=1) and you fit say arima model. predit.arima<-predict (fit

[R] help request

2012-01-12 Thread OMANE-ADJEPONG Maurice
Good day everyone, I am using the data below to fit Intervention Time Series model for two policies introduced in 2002 (54th data point) and 2003 (55th data point) respectively. Please can anyone give me a complete R code for modeling the two step functions? I have already modeled the pre-interv

Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-10 Thread Tal Galili
Hello D, Thanks for sharing your technique, nice work :) I hope the solution the people here are helping with will make it both cheaper and simpler for people with less CSS expreince. p.s: thank you for the kinds words regarding R-bloggers.com Best, Tal Contact Details:

Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread D Kelly O'Day
Tali I am one of your estimated 29 Wordpress bloggers. Thanks for your RBloggers site!! I use Wordpress.com's site for my blog. I use a simple method to highlight my R script in Wordpress, example http://chartsgraphs.wordpress.com/2010/07/17/time-series-regression-of-temperature-anomaly-data-

Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread Andrew Redd
The question would be performance issues for having too many functions. We could just limit it to the reserved keywords. Another option for the functions is to highlight anything that looks like a function with the regular expression /[\w._]+(?=\()/ that is any function name with periods and unde

Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread Tal Galili
Hello Yihui, I'd be glad to have you try and create the R brush - thanks for offering! In case you'll come up against walls, I hope there would be people in the mailing list that would be able to help out. Cheers, Tal Contact Details:-

Re: [R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread Yihui Xie
Thanks, Tal. It does not look too difficult to write such a "brush", which is actually a JS file. However, I have a concern that R has thousands of functions (in base R only), so it might not worth including all of them in the brush, which is the way that they implemented the highlighting script fo

[R] Help request: highlighting R code on WordPress.com blogs

2010-09-09 Thread Tal Galili
Hello dear R help members (and also Yihui and Romain), There are currently 28 R bloggers (out of the 117 R-bloggersI know of) that are using wordpress.com for publishing their R code (and I suspect this number will increase with time). WordPress.com doesn't support R sy