Skip to contents

Map mathematical disciplines to IDs for use in searching for mathematicians.

Usage

disciplines(search = NULL)

Arguments

a character(1) string which will search within disciplines. This can be a regular expression search term if desired.

Value

Data frame, with columns:

id

the discipline ID, as required by search_id() when searching for a mathematician within a specific mathematical discipline;

discipline

the name of the discipline classification, per the Mathematics Genealogy Project.

Examples

# Lookup the ID of any discipline involving the partial word "stat"
disciplines("stat")
#>    id                                 discipline
#> 45 62                                 Statistics
#> 54 82 Statistical mechanics, structure of matter

# Use a regular expression to only exactly match the whole word Statistics and nothing else
disciplines("^statistics$")
#>    id discipline
#> 45 62 Statistics

# Don't test next line as relies on internet resources that can be temporarily
# unavailable.
# \donttest{
# Use the above to search only for statisticians with the first name Louis
search_id(given = "Louis", discipline = disciplines("^statistics$")$id)
#> Error in (function (cnd) {    {        .__handler_frame__. <- TRUE        .__setup_frame__. <- frame        if (inherits(cnd, "message")) {            except <- c("warning", "error")        }        else if (inherits(cnd, "warning")) {            except <- "error"        }        else {            except <- ""        }    }    while (!is_null(cnd)) {        if (inherits(cnd, "error")) {            out <- handlers[[1L]](cnd)            if (!inherits(out, "rlang_zap"))                 throw(out)        }        inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")        if (is_false(inherit)) {            return()        }        cnd <- .subset2(cnd, "parent")    }})(structure(list(message = "Failed to perform HTTP request.",     trace = structure(list(call = list(search_id(given = "Louis",         discipline = disciplines("^statistics$")$id), rlang::try_fetch({        resp <- httr2::req_perform(httr2::req_body_form(httr2::req_headers(httr2::request("https://mathgenealogy.org/query-prep.php"),             `User-Agent` = get_user_agent()), family_name = family,             given_name = given, other_names = middle, school = university,             year = year, thesis = thesis_keyword, country = country,             msc = discipline))    }, error = function(e) {        if (inherits(e, "httr2_failure")) {            cli::cli_abort(c(x = "Please check your internet connection. If that is working, check whether the Maths Genealogy Project is currently down: {.url https://mathgenealogy.org/} -- if both are ok, please file a detailed reproducible bug report {.url https://github.com/louisaslett/maths.genealogy/issues}"),                 parent = e, call = rlang::caller_env())        }        else if (inherits(e, "httr2_http")) {            cli::cli_abort(c(x = "There appears to be a problem at the Maths Genealogy Project. Please try your search directly at {.url https://mathgenealogy.org/} -- if your search works on the site, then please file a detailed reproducible bug report for this package at {.url https://github.com/louisaslett/maths.genealogy/issues}"),                 parent = e, call = rlang::caller_env())        }        else {            cli::cli_abort(c(x = "Unknown error. Please file a detailed reproducible bug report for this package at {.url https://github.com/louisaslett/maths.genealogy/issues}"),                 parent = e, call = rlang::caller_env())        }    }), tryCatch(withCallingHandlers(expr, condition = function(cnd) {        {            .__handler_frame__. <- TRUE            .__setup_frame__. <- frame            if (inherits(cnd, "message")) {                except <- c("warning", "error")            }            else if (inherits(cnd, "warning")) {                except <- "error"            }            else {                except <- ""            }        }        while (!is_null(cnd)) {            if (inherits(cnd, "error")) {                out <- handlers[[1L]](cnd)                if (!inherits(out, "rlang_zap"))                   throw(out)            }            inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")            if (is_false(inherit)) {                return()            }            cnd <- .subset2(cnd, "parent")        }    }), stackOverflowError = handlers[[1L]]), tryCatchList(expr,         classes, parentenv, handlers), tryCatchOne(expr, names,         parentenv, handlers[[1L]]), doTryCatch(return(expr),         name, parentenv, handler), withCallingHandlers(expr,         condition = function(cnd) {            {                .__handler_frame__. <- TRUE                .__setup_frame__. <- frame                if (inherits(cnd, "message")) {                  except <- c("warning", "error")                }                else if (inherits(cnd, "warning")) {                  except <- "error"                }                else {                  except <- ""                }            }            while (!is_null(cnd)) {                if (inherits(cnd, "error")) {                  out <- handlers[[1L]](cnd)                  if (!inherits(out, "rlang_zap"))                     throw(out)                }                inherit <- .subset2(.subset2(cnd, "rlang"), "inherit")                if (is_false(inherit)) {                  return()                }                cnd <- .subset2(cnd, "parent")            }        }), httr2::req_perform(httr2::req_body_form(httr2::req_headers(httr2::request("https://mathgenealogy.org/query-prep.php"),         `User-Agent` = get_user_agent()), family_name = family,         given_name = given, other_names = middle, school = university,         year = year, thesis = thesis_keyword, country = country,         msc = discipline)), handle_resp(req, resp, error_call = error_call),         cnd_signal(resp)), parent = c(0L, 1L, 2L, 3L, 4L, 5L,     2L, 1L, 8L, 9L), visible = c(TRUE, TRUE, TRUE, TRUE, TRUE,     TRUE, TRUE, TRUE, FALSE, FALSE), namespace = c("maths.genealogy",     "rlang", "base", "base", "base", "base", "base", "httr2",     "httr2", "rlang"), scope = c("::", "::", "::", "local", "local",     "local", "::", "::", ":::", "::")), row.names = c(NA, -10L    ), version = 2L, class = c("rlang_trace", "rlib_trace", "tbl",     "data.frame")), parent = structure(list(message = "SSL peer certificate or SSH remote key was not OK [mathgenealogy.org]:\nSSL certificate problem: unable to get local issuer certificate",         call = curl::curl_fetch_memory(url, handle)), class = c("curl_error_peer_failed_verification",     "curl_error", "error", "condition")), call = httr2::req_perform(httr2::req_body_form(httr2::req_headers(httr2::request("https://mathgenealogy.org/query-prep.php"),         `User-Agent` = get_user_agent()), family_name = family,         given_name = given, other_names = middle, school = university,         year = year, thesis = thesis_keyword, country = country,         msc = discipline)), request = structure(list(url = "https://mathgenealogy.org/query-prep.php",         method = NULL, headers = structure(list(`User-Agent` = "R/4.5.1 maths.genealogy/0.1.3"), redact = character(0), class = "httr2_headers"),         body = list(data = list(given_name = structure("Louis", class = "AsIs"),             msc = structure("62", class = "AsIs")), type = "form",             content_type = "application/x-www-form-urlencoded",             params = list()), fields = list(), options = list(),         policies = list(), state = <environment>), class = "httr2_request")), class = c("httr2_failure", "httr2_error", "rlang_error", "error", "condition"))):  Please check your internet connection. If that is working, check
#>   whether the Maths Genealogy Project is currently down:
#>   <https://mathgenealogy.org/> -- if both are ok, please file a detailed
#>   reproducible bug report
#>   <https://github.com/louisaslett/maths.genealogy/issues>
#> Caused by error in `httr2::req_perform()`:
#> ! Failed to perform HTTP request.
#> Caused by error in `curl::curl_fetch_memory()`:
#> ! SSL peer certificate or SSH remote key was not OK [mathgenealogy.org]:
#> SSL certificate problem: unable to get local issuer certificate
# }