Skip to content

Commit e4b5de2

Browse files
Reading index
1 parent a321df2 commit e4b5de2

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

source/reading.Rmd

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Suppose our computer's filesystem looks like the picture in Figure
9292
\@ref(fig:file-system-for-export-to-intro-datascience). We are working in a
9393
file titled `worksheet_02.ipynb`, and our current working directory is `worksheet_02`;
9494
typically, as is the case here, the working directory is the directory containing the file you are currently
95-
working on.\index{Happiness Report}
95+
working on.
9696

9797
```{r file-system-for-export-to-intro-datascience, echo = FALSE, message = FALSE, warning = FALSE, fig.cap = "Example file system.", fig.retina = 2, out.width="100%"}
9898
knitr::include_graphics("img/reading/filesystem.jpeg")
@@ -120,8 +120,9 @@ Note that there is no forward slash at the beginning of a relative path; if we a
120120
R would look for a folder named `data` in the root folder of the computer—but that doesn't exist!
121121

122122
Aside from specifying places to go in a path using folder names (like `data` and `worksheet_02`), we can also specify two additional
123-
special places: the *current directory* and the *previous directory*. We indicate the current working directory with a single dot `.`, and
124-
the previous directory with two dots `..`. So for instance, if we wanted to reach the `bike_share.csv` file from the `worksheet_02` folder, we could
123+
special places: the *current directory* \index{path!current} and the *previous directory*. \index{path!previous}
124+
We indicate the current working directory with a single dot `.`, and \index{aaaaaacurdirsymb@\texttt{.}|see{path}}
125+
the previous directory with two dots `..`. \index{aaaaaprevdirsymb@\texttt{..}|see{path}} So for instance, if we wanted to reach the `bike_share.csv` file from the `worksheet_02` folder, we could
125126
use the relative path `../tutorial_01/bike_share.csv`. We can even combine these two; for example, we could reach the `bike_share.csv` file using
126127
the (very silly) path `../tutorial_01/../tutorial_01/./bike_share.csv` with quite a few redundant directions: it says to go back a folder, then open `tutorial_01`,
127128
then go back a folder again, then open `tutorial_01` again, then stay in the current directory, then finally get to `bike_share.csv`. Whew, what a long trip!
@@ -1202,15 +1203,15 @@ That should be more than enough for our purposes in this section.
12021203

12031204
#### Accessing the NASA API {-}
12041205

1205-
The NASA API is what is known as an *HTTP API*: this is a particularly common
1206+
The NASA API is what is known as an *HTTP API*: \index{API!HTTP} this is a particularly common
12061207
kind of API, where you can obtain data simply by accessing a
12071208
particular URL as if it were a regular website. To make a query to the NASA
1208-
API, we need to specify three things. First, we specify the URL *endpoint* of
1209+
API, we need to specify three things. First, we specify the URL *endpoint* of \index{API!endpoint}
12091210
the API, which is simply a URL that helps the remote server understand which
12101211
API you are trying to access. NASA offers a variety of APIs, each with its own
12111212
endpoint; in the case of the NASA "Astronomy Picture of the Day" API, the URL
12121213
endpoint is `https://api.nasa.gov/planetary/apod`. Second, we write `?`, which denotes that a
1213-
list of *query parameters* will follow. And finally, we specify a list of
1214+
list of *query parameters* \index{API!query parameters} will follow. And finally, we specify a list of
12141215
query parameters of the form `parameter=value`, separated by `&` characters. The NASA
12151216
"Astronomy Picture of the Day" API accepts the parameters shown in
12161217
Figure \@ref(fig:NASA-API-parameters).
@@ -1249,7 +1250,8 @@ Rho Ophiuchi","url":"https://apod.nasa.gov/apod/image/2307/STScI-01_RhoOph1024.p
12491250

12501251
Neat! There is definitely some data there, but it's a bit hard to
12511252
see what it all is. As it turns out, this is a common format for data called
1252-
*JSON* (JavaScript Object Notation). We won't encounter this kind of data much in this book,
1253+
*JSON* (JavaScript Object Notation). \index{JSON}\index{JavaScript Object Notation|see{JSON}}
1254+
We won't encounter this kind of data much in this book,
12531255
but for now you can interpret this data as `key : value` pairs separated by
12541256
commas. For example, if you look closely, you'll see that the first entry is
12551257
`"date":"2023-07-13"`, which indicates that we indeed successfully received
@@ -1260,6 +1262,7 @@ the `httr2` package, and construct the query using the `request` function, which
12601262
you will recognize the same query URL that we pasted into the browser earlier.
12611263
We will then send the query using the `req_perform` function, and finally
12621264
obtain a JSON representation of the response using the `resp_body_json` function.
1265+
\index{httr2!req_perform}\index{httr2!resp_body_json}
12631266

12641267
<!-- we have disabled the below code for reproducibility, with hidden setting
12651268
of the nasa_data object. But you can reproduce this using the DEMO_KEY key -->

0 commit comments

Comments
 (0)