The main parts of the bibliomatrix
package are:
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 pool to Microsoft SQL Server BIBMON database
bibmon <- pool_bib("mssql")
# get data for ABM table 1
kth_data <- abm_data(bibmon, unit_code = "KTH")
t1 <- abm_table1(kth_data)
# display first few results
t1 %>%
slice(1:5) %>%
select(1:2) %>%
kable()
Publication_Type_DiVA | 2014 |
---|---|
Article, peer review | 15387.8392 |
Article, other | 1164.3819 |
Conference paper, peer review | 8875.3077 |
Conference paper, other | 2663.2656 |
Book | 164.1667 |
# You can build a sqlite3 databsae for local use (this will take a while the first time)
db_sync()
localdb <- pool_bib("sqlite")
kth_data_local <- abm_data(localdb, unit_code = "KTH")
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")))
#> process real
#> 19.11s 2.98m
bench_time(abm_table1(abm_data(con = localdb, unit_code = "KTH")))
#> process real
#> 7.66s 7.73s
poolClose(bibmon)
poolClose(localdb)