library(httr)
library(rjson)
library(forcats)
library(dplyr)
Attaching package: 'dplyr'
The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggplot2)
Works <- GET("https://api.openalex.org/works?page=1&filter=authorships.institutions.lineage:i86987016|i161593684|i28166907,publication_year:2014-2024")
# convert to cleaner format
dataWorks <- fromJSON(rawToChar(Works$content))
CountCorrAuthor = data.frame()
for(i in 1:length(dataWorks$results)){
CountCorrAuthor <- rbind(CountCorrAuthor,length(dataWorks$results[[i]]$authorships))
}
Publisher = data.frame()
for(i in 1:length(dataWorks$results)){
Publisher <- rbind(Publisher,dataWorks$results[[i]]$primary_location$source$host_organization_name)
}
dataPuplisherAuothor <- data.frame(CountCorrAuthor, Publisher)
colnames(dataPuplisherAuothor) <- c("NoOfAuthor","Publisher")
PlotofData <-
ggplot(data=dataPuplisherAuothor, aes(x=NoOfAuthor, y=reorder(Publisher,NoOfAuthor)))+
geom_bar(stat='identity')
PlotofData + ggtitle('Number of authors in resp Publisher') +
xlab('Number of authors') +ylab('Publisher')