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

Where to find gapminder xlsx files? #1605

Open
mdavis-xyz opened this issue Dec 4, 2023 · 0 comments
Open

Where to find gapminder xlsx files? #1605

mdavis-xyz opened this issue Dec 4, 2023 · 0 comments

Comments

@mdavis-xyz
Copy link
Contributor

I'm reading Iteration: 26.3.1 Listing files in a directory:

To make our motivating example concrete, this book contains a folder with 12 excel spreadsheets containing data from the gapminder package.

paths <- list.files("data/gapminder", pattern = "[.]xlsx$", full.names = TRUE)
paths
#>  [1] "data/gapminder/1952.xlsx" "data/gapminder/1957.xlsx"
#>  [3] "data/gapminder/1962.xlsx" "data/gapminder/1967.xlsx"
#>  [5] "data/gapminder/1972.xlsx" "data/gapminder/1977.xlsx"
#>  [7] "data/gapminder/1982.xlsx" "data/gapminder/1987.xlsx"
#>  [9] "data/gapminder/1992.xlsx" "data/gapminder/1997.xlsx"
#> [11] "data/gapminder/2002.xlsx" "data/gapminder/2007.xlsx"

I assume I'm supposed to still be following along by running each code snippet on my computer. But am I supposed to have access to these files already? I don't see any hyperlinks to the dataset from the page.
Are users supposed to know that they should navigate to the github folder? Or is this available on https://r4ds.hadley.nz somewhere? (wget -r couldn't find them.)
Or should I replace data/gapminder with some function from the gapminder package that returns a path to a folder of these files?

As a second, lesser point, when I run this code I get an empty list:

> paths <- list.files("data/gapminder", pattern = "[.]xlsx$", full.names = TRUE)
> paths
character(0)

I find this behaviour surprising. I was expecting an error, because the folder doesn't exist. (Like ls in bash, or python's os.listdir.) Perhaps it's worth mentioning this behaviour?

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

1 participant