-
Notifications
You must be signed in to change notification settings - Fork 0
/
doi-count.R
36 lines (27 loc) · 890 Bytes
/
doi-count.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(tictoc)
library(jsonlite)
library(HelpersMG)
library(R.utils)
library(ckanr)
library(dplyr)
library(stringr)
install.packages("jqr")
library(jqr)
wget("https://open.canada.ca/static/od-do-canada.jsonl.gz")
R.utils::gunzip("od-do-canada.jsonl.gz", remove=T) #taking the metadata catalogue jsonlines and gunzipping
query1<-readLines("od-do-canada.jsonl") #reading it into R line by line
qqq<-jq(query1,'{id,title,metadata_created,digital_object_identifier}') %>% select(.digital_object_identifier | contains("doi.org"))
qq1<-fromJSON(qqq[[1]])
qID<-qq1$id
qtitle<-qq1$title
qmeta<-qq1$metadata_created
qdoi<-qq1$digital_object_identifier
q<-data.frame(qID,qtitle,qmeta,qdoi)
for (i in 2:length(qqq)){
qq1<-fromJSON(qqq[[i]])
qID<-qq1$id
qtitle<-qq1$title
qmeta<-qq1$metadata_created
qdoi<-qq1$digital_object_identifier
q<- q %>% add_row(qID,qtitle,qmeta,qdoi)
}