Assingment 10B-Approach

Author

Mubin Ejaz

Approach:

I’d first make just a simple call to API to make sure I can connect.
I chose the 4 questions I’d want to be answered.

library(httr2)
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ 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("DT")

req<- request("https://api.nobelprize.org/2.1/nobelPrizes") 

#actually performing the request
resp<-req_perform(req)
data<-resp_body_json(resp)
prizes <- data$nobelPrizes
prizes_df <- do.call(rbind, lapply(prizes, function(x) {
  data.frame(
    AwardYear = x$awardYear,
    category = x$category,
    PrizeAmount = x$prizeAmount
  )
}))
datatable(prizes_df)

Question 1:

What is the basic criteria for choosing the nominees?

Question 2:
Does every category ends up with a winner every year

Question 3:
Does Nobel Prize laureates data seem to be politically motivated at all?

Question 4:
Can peaple that have passed away get nobel prize?