In [ ]:
library(jsonlite)
library(dplyr)
library(stringr)
In [ ]:
get_crossref_registrant<-function(registrant) {
id<-(str_extract(registrant,'(\\d{2,6})?$'))
start <- GET(paste0('https://api.crossref.org/members/',id))
parsed <- content(start, "parsed")
item <-parsed$message
if(is.null(item$`primary-name`)){
item$`primary-name`<-""
}
return(substr(item$`primary-name`,0,10))
}
# get_registrant_data(head(registrants,1))
get_datacite_registrant<-function(registrant) {
id<-(str_extract(registrant,'([a-z])+\\.([a-z])+$'))
# print(registrant)
start <- GET(paste0('https://api.datacite.org/clients/',id))
parsed <- content(start, "parsed")
item <-parsed$data
# print(item)
if(is.null(item$attributes$name)){
item$attributes$name<-""
}
return(substr(item$attributes$name,0,13))
}
# get_registrant_data(head(registrants,1))
In [ ]:
load("../data/2018-10-08_registrants_meta.Rda",verbose=TRUE)
regs<-registrants %>% rowwise() %>% mutate(client= get_registrant_data(title))
data<-regs
file<-paste0("../data/",Sys.Date(),"_registrants_with_labels.Rda")
print(file)
save(data,file=file)