Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing path examples in vignettes #167

Open
sdspieg opened this issue Dec 21, 2020 · 3 comments
Open

Providing path examples in vignettes #167

sdspieg opened this issue Dec 21, 2020 · 3 comments

Comments

@sdspieg
Copy link

sdspieg commented Dec 21, 2020

[Not sure whether it's 'kosher' to make suggestions for the documentation in github issues, but trying anyway]
The documentation of quanteda (and readtext) is impressive. But there are often small things that may be obvious to many more experienced users, but can be terribly frustrating for beginners. The vignettes nicely illustrate various use cases for types of files; but not for different locations - they all use DATA_DIR. [The doc says that "When reading in custom text files, you will need to determine your own data directory (see ?setwd()).", but I'm still looking for that as I write this[. But so maybe you could some different PATH use cases throughout your vignettes? For a Windows user wanting to read in one (very large) json file that's in a shared Google drive folder (what to use instead of paste0 then?); for a Mac user who wants to read a folder of txt files from one of their local folders; etc.
Just a suggestion!

@kbenoit
Copy link
Collaborator

kbenoit commented Dec 22, 2020

Good suggestions, thanks. You're talking about familiarity with the command line and how operating systems provide file locations, but we could provide examples for Windows and other operating systems.

@pgbarrioslech
Copy link

Yes! I am a beginning programmer and would appreciate examples in the vignette with local pathnames in Mac, and Windows.

@pgbarrioslech
Copy link

pgbarrioslech commented May 17, 2021

Ok, I figured this out. The key is simply to:

DATA_DIR <- getwd()

for local path.

Then

rt_2 <- readtext(paste0(DATA_DIR, "/*.docx")) [for example]

Incidentally, you need the forward slash "/*.docx"; if you omit it, this happens:

rt_2 <- readtext(paste0(DATA_DIR, "*.docx"))

Error in list_files(file, ignore_missing, TRUE, verbosity) :
File '' does not exist.

This is probably obvious to everyone except beginning programmers like myself; I post here in case it helps them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants