library(httr)
library(jsonlite)
library(dplyr)
prize <- fromJSON("https://api.nobelprize.org/2.1/nobelPrizes")
laureates <- fromJSON("https://api.nobelprize.org/2.1/laureates")
prize <- prize$nobelPrizes
nobel <- data.frame(prize$awardYear, prize$category[1], prize$prizeAmount, prize$prizeAmountAdjusted, prize$dateAwarded)
colnames(nobel) <- c("Award_Year", "Category", "Prize_Amt", "Prize_Amt_Adj", "Date_Awarded")
laureates <- laureates$laureates
d <- data.frame(bind_rows(laureates$death)) %>% select(date)
colSums(is.na(d))
## date
## 12
** Of all the Nobel Prize Laureates given by the API call, 12 are alive.**
laureates%>%
count(gender) %>%
mutate(p = n /sum(n))
## gender n p
## 1 female 1 0.04
## 2 male 24 0.96
The ratio of female to male Nobel Prize Laureates is 24:1
Information of the female Laureate(s)
l <- laureates%>% filter(gender == "female")
name <- l$fullName$en
l <- bind_rows(l$nobelPrizes)
date <- l$dateAwarded
category <- l$category$en
Motivation <- l$motivation$en
female_info <- data.frame(Name = name, Date_Awarded = date, category <- category, Motivation)
female_info
## Name Date_Awarded category....category
## 1 Ada E. Yonath 2009-10-07 Chemistry
## Motivation
## 1 for studies of the structure and function of the ribosome
#How many laureates are affiliated with a university for each country?
x <- bind_rows(laureates$nobelPrizes)
x <- bind_rows(x$affiliations)
x <- x$countryNow %>%
count(en)
colnames(x) <- c("Country", "Laureates")