НачатьНачать бесплатно

From JSON to R

In the simplest setting, fromJSON() can convert character strings that represent JSON data into a nicely structured R list. Give it a try!

Это упражнение является частью курса

Intermediate Importing Data in R

Посмотреть курс

Инструкции к упражнению

  • Load the jsonlite package. It's already installed on DataCamp's servers.
  • wine_json represents a JSON. Use fromJSON() to convert it to a list, named wine.
  • Display the structure of wine

Интерактивное практическое упражнение

Попробуйте выполнить это упражнение, дополнив этот пример кода.

# Load the jsonlite package


# wine_json is a JSON
wine_json <- '{"name":"Chateau Migraine", "year":1997, "alcohol_pct":12.4, "color":"red", "awarded":false}'

# Convert wine_json into a list: wine


# Print structure of wine
Редактировать и запускать код