JSON practice (2)
We prepared two more JSON strings in the sample code. Can you change them and call jsonlite's fromJSON() function on them, similar to the previous exercise?
Acest exercițiu face parte din cursul
Intermediate Importing Data in R
Instrucțiuni pentru exercițiu
- Remove characters from
json1to build a 2 by 2 matrix containing only 1, 2, 3 and 4. CallfromJSON()onjson1. - Add characters to
json2such that the data frame in which the json is converted contains an additional observation in the last row. For this observations,aequals 5 andbequals 6. CallfromJSON()one last time, onjson2.
Exercițiu interactiv practic
Încearcă acest exercițiu completând acest cod de exemplu.
# jsonlite is already loaded
# Challenge 1
json1 <- '[[1, 2], [3, 4], [5, 6]]'
# Challenge 2
json2 <- '[{"a": 1, "b": 2}, {"a": 3, "b": 4}]'