[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R]  Help request: Parsing docx files for key words and appending to
From:       Ivan Krylov <krylov.r00t () gmail ! com>
Date:       2023-12-30 15:23:32
Message-ID: 20231230182332.23f5f239 () Tarkus
[Download RAW message or body]

В Sat, 30 Dec 2023 12:18:52 +0000
Andy <phaedrusv@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,
Ivan

[1]
http://web.archive.org/web/20230415001551/http://ashipunov.info/shipunov/school/biol_240/en/visual_statistics.pdf


[2]
https://www.burns-stat.com/documents/books/the-r-inferno/

______________________________________________
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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic