context(desc = "Import pubmed functions")
test_that("Function sigaps rank", {
expect_equal(calc_sigaps_rank(1, 8), "1")
expect_equal(calc_sigaps_rank(2, 8), "2")
expect_equal(calc_sigaps_rank(3, 8), "3")
expect_equal(calc_sigaps_rank(5, 8), "Other")
expect_equal(calc_sigaps_rank(8, 8), "Last")
expect_equal(calc_sigaps_rank(1, 1), "1")
expect_equal(calc_sigaps_rank(2, 2), "Last")
expect_equal(calc_sigaps_rank(3, 3), "Last")
})
test_that("URL query", {
pubmed_query <- make_pubmed_query("Muller", "Joris")
expect_equal(make_publication_list_url(pubmed_query), "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&usehistory=y&term=Muller+Joris[AU]+AND+(2015[DP]+:+2017[DP])")
})
test_that("Get proper table after import in pubmed",{
library(dplyr)
df <- import_author_pubmed("Muller", "Joris")
expect_equal(nrow(df), 18)
})
test_that("Affiliation query maker", {
expect_equal(make_affiliation_query("Strasbourg"), "(Strasbourg[Affiliation])")
expect_equal(make_affiliation_query(c("Strasbourg", "Paris")), "(Strasbourg[Affiliation] OR Paris[Affiliation])")
}
)
test_that("Pubmed Query maker",{
expect_equal(
make_pubmed_query("Muller", "J"),
paste("Muller J[AU] AND (Journal Article[Publication Type]",
"OR Review[Publication Type] OR Editorial[Publication Type])" )
),
expect_equal(
make_pubmed_query("Napoleon", affiliation = "Ajaccio")
)
} )
test_that("Import xml file",{
file_path <- system.file("extdata", "pubmed_joris_muller.xml", package = "rigaps")
expect_true(file.exists(file_path))
df <- import_xml_pubmed(x = file_path, as_html = FALSE, lastname = "Muller", firstname = "J")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.