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

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Sat Dec 30 16:23:32 CET 2023

В Sat, 30 Dec 2023 12:18:52 +0000
Andy <phaedrusv using gmail.com> пишет:

> 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(), which results in slightly more compact,
self-documenting code.

Nowadays, using '/' as the directory separator can be considered
portable, one notable exception being some Windows cmd.exe built-ins
(where '/' is interpreted as flag specifier). Perl5 documentation
mentions Classic MacOS using ':' as the directory separator (and many
other operating systems supporting or emulating Unix-style '/'
separators), but that hasn't been relevant for a long while.

> Error in x$doc_obj : $ operator is invalid for atomic vectors

Which line of code produces the error? What is the argument of
docx_summary() at this point?

Since you're learning R, I can recommend a couple of free books: Visual
Statistics [1] to study the basics of R and The R Inferno [2] for when
you get stuck.

Best regards,



More information about the R-help mailing list