Using rlist to work with nested data structures
In the previous chapter, you learned about both relational databases that store data in tables and non-relational databases that support nested data structures. In R, the most commonly used nested data structure is a list object. All previous sections focus on manipulating tabular data. In this section, let's play with the rlist
package I developed, which is designed for manipulating non-tabular data.
The design of rlist
is very similar to dplyr
. It provides mapping, filtering, selecting, sorting, grouping, and aggregating functionality for list objects. Run the following code to install the rlist
package from CRAN:
install.packages("rlist")
We have the non-tabular version of the product data stored in data/products.json
. In this file, each product has a JSON representation as follows:
{ "id": "T01", "name": "SupCar", "type": "toy", "...