knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
The goal of XsearchLIBRIS is to provide access to search results from LIBRIS Xsearch API directly in R.
LIBRIS is an online search service of the National Library of Sweden. Search national, academic, and several public libraries of Sweden for books, periodicals, articles, maps, posters, printed music, electronic resources, and more.
You can install the latest version of XsearchLIBRIS from GitHub with:
#install.packages("devtools") install_github("KTH-Library/XsearchLIBRIS", dependencies = TRUE)
The database used can be specified - the default is to use LIBRIS but "swepub" is also available.
This is a basic example which shows you how make a search:
library(XsearchLIBRIS) suppressPackageStartupMessages(library(dplyr)) library(knitr) # search and display first two hits for "film noir" kable(xsearch(query = "WAMK:\"film noir\"")$content %>% slice(1:2)) # search for publications by Vitruvius in Swedish "PERS:(vitruvius) SPR:swe" %>% xsearch() %>% .$content %>% kable() # search SwePub for publications about timber framing in Swedish xsearch(query = "stolpverk SPR:swe", database = "swepub") %>% .$content %>% mutate(summary = paste( # generate summary snippet in markdown format sprintf("[%s](%s)", identifier, sprintf("%s (%s:%s)", title, type, relation)), sprintf("\n%s...", substr(description, 1, 250))) ) %>% select(`Search hit summaries` = summary) %>% kable()
A function provides HTML for a LIBRIS searchbox which can be integrated in HTML documents such as a chunk in an rmarkdown
document:
libris_searchbox_html()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.