Skip to contents

The main parts of the bibliomatrix package are:

  • A public dataset for the KTH Annual Bibliometric Monitoring (ABM)
  • A Shiny app and a flexdashboard layout for presenting the ABM
  • Functions related to filling the ABM presentation with results

Getting started

First load some useful packages, including bibliomatrix:

library(bibliomatrix)
library(dplyr)
#> Warning: package 'dplyr' was built under R version 4.4.3
library(stringr)
#> Warning: package 'stringr' was built under R version 4.4.3
library(readr)
library(knitr)
library(bench)
library(DBI)
#> Warning: package 'DBI' was built under R version 4.4.3
library(dbplyr)

if (Sys.info()["sysname"] == "Windows") 
  readRenviron(file.path(Sys.getenv("R_USER"), ".Renviron"))

Data for Annual Bibliometric Monitoring (ABM)

In order to get data from the Microsoft SQL Server database, an .Renviron file is currently required with values being provided for the following envvars: DBUSER (the MSSQL Server service account name for the BIBMON db), DBPASS, DBHOST (the hostname for the MSSQL server) and DBNAME (use “BIBMON”).

Once this has been provided in the .Renviron file, data for the ABM tables can be retrieved.

NOTE: For the public part of ABM, no database connection is needed, see Using bundled data in bibliomatrix.

# Open a connection to Microsoft SQL Server BIBMON database
bibmon <- con_bib("mssql")

# get data for ABM table 1
kth_data <- abm_data(bibmon, unit_code = "KTH", analysisId = abm_config()$analysis_id)
t1 <- abm_table1(kth_data)

# display first few results
t1 %>% 
  slice(1:5) %>% 
  select(1:2) %>% 
  kable()
Publication_Type_DiVA 2016
Article, peer review 1506.26271
Article, other 125.07269
Conference paper, peer review 715.21516
Conference paper, other 205.10000
Book 21.48333

# You can build a sqlite3 databsae for local use (this will take a while the first time)
db_sync()
localdb <- con_bib("sqlite")
kth_data_local <- abm_data(localdb, unit_code = "KTH", analysisId = abm_config()$analysis_id)
t2 <- abm_table1(kth_data_local)

# are the results the same?
identical(t1, t2)
#> [1] TRUE

# what about performance?
bench_time(abm_table1(abm_data(con = bibmon, unit_code = "KTH", analysisId = abm_config()$analysis_id)))
#> process    real 
#>   2.11s   9.02s
bench_time(abm_table1(abm_data(con = localdb, unit_code = "KTH", analysisId = abm_config()$analysis_id)))
#> process    real 
#>   9.95s  10.08s

dbDisconnect(bibmon)
dbDisconnect(localdb)