เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Import JSON data from API

As Filip showed in the video, fromJSON() also works if you pass a URL as a character string or the path to a local file that contains JSON data. Let's try this out on the OMDb API, where you can fetch all sorts of movie data.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Intermediate Importing Data in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • omdb_url represents a URL. Use fromJSON() directly on this URL and store the result in omdb_url.
  • Display the structure of omdb_url.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# jsonlite is preloaded

# Definition of omdb_url
omdb_url <- "http://www.omdbapi.com/?apikey=72bc447a&i=tt0076759&r=json"

# Import OMDb data: omdb_data


# Print structure of omdb_data
แก้ไขและรันโค้ด