Fixing typos in hierarchy.Rmd (#308)
This commit is contained in:
parent
9610cbb771
commit
727e36097a
|
@ -37,7 +37,7 @@ Sometimes you get data structures that are very deeply nested. A common source o
|
||||||
issues <- jsonlite::fromJSON("issues.json", simplifyVector = FALSE)
|
issues <- jsonlite::fromJSON("issues.json", simplifyVector = FALSE)
|
||||||
```
|
```
|
||||||
|
|
||||||
You might be tempted to use `str()` on this data. Unfortunately, however, `str()` is not designed for lists that are both deep and wide, and you'll tend to get overwhelemd by the output. A better strategy is to pull the list apart piece by piece.
|
You might be tempted to use `str()` on this data. Unfortunately, however, `str()` is not designed for lists that are both deep and wide, and you'll tend to get overwhelmed by the output. A better strategy is to pull the list apart piece by piece.
|
||||||
|
|
||||||
First, figure out how many elements are in the list, take a look at one, and then check they're all the same structure. In this case there are eight elements, and the first element is another list.
|
First, figure out how many elements are in the list, take a look at one, and then check they're all the same structure. In this case there are eight elements, and the first element is another list.
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ To get the results into a character vector, we need to tell purrr what it should
|
||||||
issues %>% map_chr(c("pull_request", "html_url"), .null = NA)
|
issues %>% map_chr(c("pull_request", "html_url"), .null = NA)
|
||||||
```
|
```
|
||||||
|
|
||||||
(You might wonder why that isn't the default value since it's so useful. Well, if it was the default, you'd never get an error message if you had a typo in the names. You'd just get a vector of missing values. That would be annoying to debug becase it's a silent failure.)
|
(You might wonder why that isn't the default value since it's so useful. Well, if it was the default, you'd never get an error message if you had a typo in the names. You'd just get a vector of missing values. That would be annoying to debug because it's a silent failure.)
|
||||||
|
|
||||||
It's possible to mix position and named indexing by using a list
|
It's possible to mix position and named indexing by using a list
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue