assignment_10B

Approach

Brainstorm

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.0     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.2     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.1     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(jsonlite)

Attaching package: 'jsonlite'

The following object is masked from 'package:purrr':

    flatten
df <- fromJSON("https://api.nobelprize.org/2.1/nobelPrizes")
glimpse(df)
List of 3
 $ nobelPrizes:'data.frame':    25 obs. of  8 variables:
  ..$ awardYear          : chr [1:25] "1901" "1901" "1901" "1901" ...
  ..$ category           :'data.frame': 25 obs. of  3 variables:
  .. ..$ en: chr [1:25] "Chemistry" "Literature" "Peace" "Physics" ...
  .. ..$ no: chr [1:25] "Kjemi" "Litteratur" "Fred" "Fysikk" ...
  .. ..$ se: chr [1:25] "Kemi" "Litteratur" "Fred" "Fysik" ...
  ..$ categoryFullName   :'data.frame': 25 obs. of  3 variables:
  .. ..$ en: chr [1:25] "The Nobel Prize in Chemistry" "The Nobel Prize in Literature" "The Nobel Peace Prize" "The Nobel Prize in Physics" ...
  .. ..$ no: chr [1:25] "Nobelprisen i kjemi" "Nobelprisen i litteratur" "Nobels fredspris" "Nobelprisen i fysikk" ...
  .. ..$ se: chr [1:25] "Nobelpriset i kemi" "Nobelpriset i litteratur" "Nobels fredspris" "Nobelpriset i fysik" ...
  ..$ dateAwarded        : chr [1:25] "1901-11-12" "1901-11-14" "1901-12-10" "1901-11-12" ...
  ..$ prizeAmount        : int [1:25] 150782 150782 150782 150782 150782 141847 141847 141847 141847 141847 ...
  ..$ prizeAmountAdjusted: int [1:25] 10833458 10833458 10833458 10833458 10833458 10191492 10191492 10191492 10191492 10191492 ...
  ..$ links              :List of 25
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  .. ..$ :'data.frame': 1 obs. of  4 variables:
  ..$ laureates          :List of 25
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 2 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 2 obs. of  7 variables:
  .. ..$ :'data.frame': 2 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 3 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 2 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
  .. ..$ :'data.frame': 1 obs. of  7 variables:
 $ meta       :List of 6
  ..$ offset    : int 0
  ..$ limit     : int 25
  ..$ count     : int 682
  ..$ terms     : chr "https://www.nobelprize.org/about/terms-of-use-for-api-nobelprize-org-and-data-nobelprize-org/"
  ..$ license   : chr "https://www.nobelprize.org/about/terms-of-use-for-api-nobelprize-org-and-data-nobelprize-org/#licence"
  ..$ disclaimer: chr "https://www.nobelprize.org/about/terms-of-use-for-api-nobelprize-org-and-data-nobelprize-org/#disclaimer"
 $ links      :List of 4
  ..$ first: chr "http://nobel-external-api-app.azurewebsites.net/2.1/nobelPrizes?offset=0&limit=25"
  ..$ self : chr "http://nobel-external-api-app.azurewebsites.net/2.1/nobelPrizes?offset=0&limit=25"
  ..$ next : chr "http://nobel-external-api-app.azurewebsites.net/2.1/nobelPrizes?offset=25&limit=25"
  ..$ last : chr "http://nobel-external-api-app.azurewebsites.net/2.1/nobelPrizes?offset=675&limit=25"

Lot of nested dataframes and lists. Seems better to read the documentation where it’s better to create an https request. Unless the request is to use https://api.nobelprize.org/2.1/nobelPrizes?

Questions

After understanding the data, I can come up with the following questions:

  • Did Friedrich Nietzsche ever win a Nobel Prize?
  • What was Betrand Russell’s motivation for winning a prize?
  • Who won the Nobel Prize in Literature in 2010-2020?
  • What is the overall ratio of male to female Nobel Prize laureates? Among the five countries with the most birthed laureates, what is the male-to-female ratio in each country?

Nietzsche

Bool response for the query: http://api.nobelprize.org/2.0/laureates?name=Friedrich%20Nietzsche

Betrand Russell

Return motivation columns from the query: http://api.nobelprize.org/2.0/laureates?name=Betrand%20Russell

Nobel Prize Literature 2010-2020

http://api.nobelprize.org/2.0/laureates?nobelPrizeYear=2010&yearTo=2020&nobelPrizeCategory=lit

Ratio of male to Female Nobel Prize laureates and country outliers.

We would use the full laureates dataset to calculate the overall male-to-female ratio among Nobel Prize laureates. Then we would group laureates by birthContinent, select the five continents with the most laureates, and calculate the ratio for each continent.

http://api.nobelprize.org/2.0/laureates

Codebase