| Title: | AnnotationGx: A package for building, updating and querying an annotation database for pharmaco-genomic data |
|---|---|
| Description: | A package for building, updating and querying an annotation database for pharmaco-genomic data. Provides API interfaces to various bioinformatic and chemoinformatic databases, as well as a set of functions for curating your data using the annotations retrieved from those APIs. |
| Authors: | Michael Tran [aut], Jermiah Joseph [aut], Christopher Eeles [aut], Benjamin Haibe-Kains [aut, cre] |
| Maintainer: | Benjamin Haibe-Kains <[email protected]> |
| License: | GPL-3 |
| Version: | 0.99.15 |
| Built: | 2026-11-24 01:17:31 UTC |
| Source: | https://github.com/bioc/AnnotationGx |
This function takes a Cellosaurus accession and returns annotations for the cell line.
annotateCellAccession( accessions, to = c("id", "ac", "hi", "sy", "ca", "sx", "ag", "di", "derived-from-site", "misspelling", "dt"), query_only = FALSE, raw = FALSE )annotateCellAccession( accessions, to = c("id", "ac", "hi", "sy", "ca", "sx", "ag", "di", "derived-from-site", "misspelling", "dt"), query_only = FALSE, raw = FALSE )
accessions |
The Cellosaurus accession to annotate. |
to |
A character vector specifying the types of annotations to retrieve. Possible values include "id", "ac", "hi", "sy", "ca", "sx", "ag", "di", "derived-from-site", "misspelling", and "dt". |
query_only |
A logical value indicating whether to only return the query string. |
raw |
A logical value indicating whether to return the raw response. |
A data frame containing the annotations for the cell line.
annotateCellAccession("CVCL_0031") annotateCellAccession("CVCL_0031", to = c("id", "ac", "hi", "sy"))annotateCellAccession("CVCL_0031") annotateCellAccession("CVCL_0031", to = c("id", "ac", "hi", "sy"))
This function retrieves information about a PubChem compound based on the provided compound ID (CID).
annotatePubchemCompound( cids, heading = "ChEMBL ID", source = NULL, parse_function = identity, query_only = FALSE, raw = FALSE, nParallel = 1 )annotatePubchemCompound( cids, heading = "ChEMBL ID", source = NULL, parse_function = identity, query_only = FALSE, raw = FALSE, nParallel = 1 )
cids |
The compound ID (CID) of the PubChem compound. |
heading |
The type of information to retrieve. Default is "ChEMBL ID". |
source |
The data source to use. Default is NULL. |
parse_function |
A custom parsing function to process the response. Default is the identity function. |
query_only |
Logical indicating whether to return the query URL only. Default is FALSE. |
raw |
Logical indicating whether to return the raw response. Default is FALSE. |
nParallel |
The number of parallel processes to use. Default is 1. |
The annotated information about the PubChem compound.
annotatePubchemCompound(cid = 2244) annotatePubchemCompound(cid = c(2244, 67890), heading = "CAS")annotatePubchemCompound(cid = 2244) annotatePubchemCompound(cid = c(2244, 67890), heading = "CAS")
A column-reduced example sample metadata table derived from Cancer Cell Line Encyclopedia/DepMap resources.
data(CCLE_sampleMetadata)data(CCLE_sampleMetadata)
A data.table with 1461 rows and 4 columns:
CCLE cell line identifier.
DepMap identifier.
Cell line display name.
Parsed cell line identifier used by examples.
CCLE/DepMap resources; BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.3905462. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(CCLE_sampleMetadata) head(CCLE_sampleMetadata)data(CCLE_sampleMetadata) head(CCLE_sampleMetadata)
A column-reduced example treatment metadata table derived from legacy CCLE pharmacological profiling data.
data(CCLE_treatmentMetadata)data(CCLE_treatmentMetadata)
A data.table with 24 rows and 1 column:
CCLE treatment name.
CCLE legacy pharmacological profiling data,
https://data.broadinstitute.org/ccle_legacy_data/pharmacological_profiling/CCLE_NP24.2009_profiling_2012.02.20.csv;
BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.3905462. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(CCLE_treatmentMetadata) head(CCLE_treatmentMetadata)data(CCLE_treatmentMetadata) head(CCLE_treatmentMetadata)
This function retrieves the list of fields available in the Cellosaurus schema.
It internally calls the .cellosaurus_schema() function to fetch the schema
and extracts the list of fields from it.
cellosaurus_fields(common = FALSE, upper = FALSE)cellosaurus_fields(common = FALSE, upper = FALSE)
common |
Logical indicating whether to return only the common fields. Default is FALSE. |
upper |
Logical indicating whether to return the fields in uppercase. Default is FALSE. |
A character vector containing the list of fields in the Cellosaurus schema.
cellosaurus_fields() cellosaurus_fields(common = TRUE) cellosaurus_fields(upper = TRUE)cellosaurus_fields() cellosaurus_fields(common = TRUE) cellosaurus_fields(upper = TRUE)
This function retrieves the version of the Cellosaurus API.
cellosaurusAPIVersion()cellosaurusAPIVersion()
The version of the Cellosaurus API.
cellosaurusAPIVersion()cellosaurusAPIVersion()
This function takes a character string as input and performs several cleaning operations to remove special characters, formatting, and unwanted substrings. The cleaned string is then returned as the output.
cleanCharacterStrings(name, space_action = "")cleanCharacterStrings(name, space_action = "")
name |
A character string to be cleaned. |
space_action |
A character vector specifying the actions to be taken for space characters. One of c("", "-", " "). |
The cleaned character string.
cleanCharacterStrings("Cisplatin: 1 mg/mL (1.5 mM); 5 mM in DMSO")cleanCharacterStrings("Cisplatin: 1 mg/mL (1.5 mM); 5 mM in DMSO")
A column-reduced example sample metadata table derived from Cancer Therapeutics Response Portal v2 metadata.
data(CTRP_sampleMetadata)data(CTRP_sampleMetadata)
A data.table with 1107 rows and 2 columns:
CTRP master cell line identifier.
CTRP cell line name.
Cancer Therapeutics Response Portal v2 / NCI CTD2,
https://ctd2-data.nci.nih.gov/Public/Broad/CTRPv2.0_2015_ctd2_ExpandedDataset/CTRPv2.0_2015_ctd2_ExpandedDataset.zip;
BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.3905470. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(CTRP_sampleMetadata) head(CTRP_sampleMetadata)data(CTRP_sampleMetadata) head(CTRP_sampleMetadata)
A column-reduced example treatment metadata table derived from Cancer Therapeutics Response Portal v2 metadata.
data(CTRP_treatmentMetadata)data(CTRP_treatmentMetadata)
A data.table with 545 rows and 2 columns:
CTRP compound name.
Broad compound identifier.
Cancer Therapeutics Response Portal v2 / NCI CTD2,
https://ctd2-data.nci.nih.gov/Public/Broad/CTRPv2.0_2015_ctd2_ExpandedDataset/CTRPv2.0_2015_ctd2_ExpandedDataset.zip;
BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.3905470. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(CTRP_treatmentMetadata) head(CTRP_treatmentMetadata)data(CTRP_treatmentMetadata) head(CTRP_treatmentMetadata)
A column-reduced example sample metadata table derived from Genentech Cell Line Screening Initiative (gCSI) metadata.
data(gCSI_sampleMetadata)data(gCSI_sampleMetadata)
A data.table with 1350 rows and 2 columns:
gCSI cell line name.
ENA sample accession.
gCSI source metadata; BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.4737437. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(gCSI_sampleMetadata) head(gCSI_sampleMetadata)data(gCSI_sampleMetadata) head(gCSI_sampleMetadata)
A column-reduced example treatment metadata table derived from gCSI response metadata.
data(gCSI_treatmentMetadata)data(gCSI_treatmentMetadata)
A data.table with 44 rows and 2 columns:
gCSI treatment name.
Normalized gCSI treatment name.
gCSI source metadata; BHKLab-curated PSet on ORCESTRA,
https://www.orcestra.ca/pset/10.5281/zenodo.4737437. See
system.file("extdata", "LICENSES.md", package = "AnnotationGx") for
bundled data provenance notes.
data(gCSI_treatmentMetadata) head(gCSI_treatmentMetadata)data(gCSI_treatmentMetadata) head(gCSI_treatmentMetadata)
This function retrieves the Chembl filter types.
getChemblFilterTypes()getChemblFilterTypes()
A list of Chembl filter types.
getChemblFilterTypes()getChemblFilterTypes()
This function retrieves information about the mechanism of action for a given ChEMBL ID.
getChemblMechanism( chembl.ID, resources = "mechanism", field = "molecule_chembl_id", filter_type = "in", returnURL = FALSE, raw = FALSE )getChemblMechanism( chembl.ID, resources = "mechanism", field = "molecule_chembl_id", filter_type = "in", returnURL = FALSE, raw = FALSE )
chembl.ID |
The ChEMBL ID of the molecule. |
resources |
The ChEMBL resource to query (default: "mechanism"). |
field |
The field to filter on (default: "molecule_chembl_id"). |
filter_type |
The filter type to use (default: "in"). |
returnURL |
Logical indicating whether to return the constructed URL (default: FALSE). |
raw |
Logical indicating whether to return the raw response JSON (default: FALSE). |
A data.table containing the retrieved mechanism information.
# Requires the live ChEMBL service. tryCatch({ getChemblMechanism("CHEMBL1413") getChemblMechanism("CHEMBL1413", resources = "mechanism", field = "molecule_chembl_id", filter_type = "in", returnURL = FALSE, raw = FALSE ) }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })# Requires the live ChEMBL service. tryCatch({ getChemblMechanism("CHEMBL1413") getChemblMechanism("CHEMBL1413", resources = "mechanism", field = "molecule_chembl_id", filter_type = "in", returnURL = FALSE, raw = FALSE ) }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })
This function retrieves the fields of a Chembl resource.
getChemblResourceFields(resource)getChemblResourceFields(resource)
resource |
The Chembl resource. |
A character vector containing the names of the fields.
# Requires the live ChEMBL service. tryCatch({ getChemblResourceFields("molecule") }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })# Requires the live ChEMBL service. tryCatch({ getChemblResourceFields("molecule") }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })
This function retrieves the Chembl resources.
getChemblResources()getChemblResources()
A list of Chembl resources.
getChemblResources()getChemblResources()
This function retrieves the main types from the Oncotree database.
getOncotreeMainTypes()getOncotreeMainTypes()
A data.table containing the main types from the Oncotree database.
# Requires internet connection to Oncotree API if (interactive()) { getOncotreeMainTypes() }# Requires internet connection to Oncotree API if (interactive()) { getOncotreeMainTypes() }
This function retrieves the tumor types from the Oncotree database.
getOncotreeTumorTypes()getOncotreeTumorTypes()
A data.table containing the tumor types from the Oncotree database.
# Requires internet connection to Oncotree API if (interactive()) { getOncotreeTumorTypes() }# Requires internet connection to Oncotree API if (interactive()) { getOncotreeTumorTypes() }
This function retrieves the available versions of Oncotree.
getOncotreeVersions()getOncotreeVersions()
A data.table containing available Oncotree versions.
# Requires internet connection to Oncotree API if (interactive()) { getOncotreeVersions() }# Requires internet connection to Oncotree API if (interactive()) { getOncotreeVersions() }
Get annotation headings (name only) based on type and heading criteria.
getPubchemAnnotationHeadings(type = "all", heading = NULL)getPubchemAnnotationHeadings(type = "all", heading = NULL)
type |
The type of annotation headings to retrieve. Options include "Compound", "Gene", "Taxonomy", "Element", "Assay", "Protein", "Cell", "Pathway", or "all" (default). |
heading |
The specific heading to filter the results by. Defaults to NULL, which retrieves all headings. |
A data.table containing the annotation headings and types.
getPubchemAnnotationHeadings() getPubchemAnnotationHeadings(type = "Compound") getPubchemAnnotationHeadings(heading = "ChEMBL*") getPubchemAnnotationHeadings(type = "Compound", heading = "ChEMBL*")getPubchemAnnotationHeadings() getPubchemAnnotationHeadings(type = "Compound") getPubchemAnnotationHeadings(heading = "ChEMBL*") getPubchemAnnotationHeadings(type = "Compound", heading = "ChEMBL*")
This function retrieves compound information from PubChem using the PubChem REST API. Used by other functions to retrieve compound information.
getPubchemCompound( ids, from = "cid", to = "property", properties = c("Title", "InChIKey"), raw = FALSE, query_only = FALSE, output = "JSON", ... )getPubchemCompound( ids, from = "cid", to = "property", properties = c("Title", "InChIKey"), raw = FALSE, query_only = FALSE, output = "JSON", ... )
ids |
A vector of compound identifiers. |
from |
The source namespace of the compound identifiers. Default is 'cid'. |
to |
The target namespace for the compound information. Default is 'property'. |
properties |
A character vector specifying the properties to retrieve. |
raw |
Logical indicating whether to return the raw query results. Default is FALSE. |
query_only |
Logical indicating whether to only perform the query without retrieving the results. Default is FALSE. |
output |
The format of the query results. Default is 'JSON'. |
... |
Additional arguments to be passed to the query_pubchem_rest function. |
A data.table containing the retrieved compound information.
properties <- c("Title", "MolecularFormula", "InChIKey", "CanonicalSMILES") getPubchemCompound(c(3672, 176870), from = "cid", to = "property", properties = properties)properties <- c("Title", "MolecularFormula", "InChIKey", "CanonicalSMILES") getPubchemCompound(c(3672, 176870), from = "cid", to = "property", properties = properties)
This function retrieves the PubChem XML schema from the specified URL and extracts the property information from it. The property information includes the name and type of each property.
getPubchemProperties()getPubchemProperties()
A data table containing the extracted property information.
# Requires internet connection to PubChem if (interactive()) { getPubchemProperties() }# Requires internet connection to PubChem if (interactive()) { getPubchemProperties() }
This function sends a request to PubChem to retrieve the status of a given URL. It returns the status code and, if specified, the parsed information from the response.
getPubchemStatus( returnMessage = FALSE, printMessage = TRUE, url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/Aspirin/cids/JSON" )getPubchemStatus( returnMessage = FALSE, printMessage = TRUE, url = "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/Aspirin/cids/JSON" )
returnMessage |
Logical indicating whether to return the parsed information from the response. |
printMessage |
Logical indicating whether to print the status message. |
url |
The URL to send the request to. Default is "https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/Aspirin/cids/JSON". |
The status code of the response. If returnMessage is TRUE, the parsed information from the response is also returned.
getPubchemStatus() getPubchemStatus(returnMessage = TRUE) getPubchemStatus(printMessage = FALSE)getPubchemStatus() getPubchemStatus(returnMessage = TRUE) getPubchemStatus(printMessage = FALSE)
Get the list of sources in UniChem.
getUnichemSources(all_columns = FALSE)getUnichemSources(all_columns = FALSE)
all_columns |
Returns a
|
A data.table with the list of sources in UniChem.
Release metadata not provided by UniChem are returned as NA.
# Requires internet connection to UniChem if (interactive()) { getUnichemSources() }# Requires internet connection to UniChem if (interactive()) { getUnichemSources() }
This function maps cell line IDs to accession numbers using the Cellosaurus database.
mapCell2Accession( ids, numResults = 10000, from = "idsy", sort = "ac", keep_duplicates = FALSE, fuzzy = FALSE, query_only = FALSE, raw = FALSE, parsed = TRUE, include_query = TRUE, ... )mapCell2Accession( ids, numResults = 10000, from = "idsy", sort = "ac", keep_duplicates = FALSE, fuzzy = FALSE, query_only = FALSE, raw = FALSE, parsed = TRUE, include_query = TRUE, ... )
ids |
A character vector of cell line IDs. |
numResults |
The maximum number of results to return for each query. Default is 1000. |
from |
The type of input IDs. Possible values are "idsy" (default), "ac", "id", "sy", and "misspelling". |
sort |
The sorting order of the results. Possible values are "ac" (default), "id", "sy", and "misspelling". |
keep_duplicates |
Logical indicating whether to keep duplicate results. Default is FALSE. |
fuzzy |
Logical indicating whether to perform a fuzzy search. Default is FALSE. |
query_only |
Logical indicating whether to return only the query URLs. Default is FALSE. |
raw |
Logical indicating whether to return the raw HTTP responses. Default is FALSE. |
parsed |
Logical indicating whether to parse the response text. Default is TRUE. |
include_query |
Logical indicating whether to include the |
... |
Currently unused. Reserved for future extensions. |
A data.table containing the mapped cell line IDs and accession numbers.
When parsed = FALSE, the returned table also includes Cellosaurus metadata
columns that have been renamed to user-friendly titles (for example, sy
becomes synonyms).
mapCell2Accession(ids = c("A549", "MCF7"))mapCell2Accession(ids = c("A549", "MCF7"))
This function maps PubChem Compound IDs to specified properties using the PubChem REST API.
See getPubchemProperties for a list of available properties.
mapCID2Properties(ids, properties, ...)mapCID2Properties(ids, properties, ...)
ids |
A vector of PubChem Compound IDs. |
properties |
A vector of property names to retrieve for each compound. |
... |
Additional arguments to be passed to the |
A data frame containing the mapped properties for each compound.
mapCID2Properties(ids = c(123, 456), properties = c("MolecularWeight", "CanonicalSMILES"))mapCID2Properties(ids = c(123, 456), properties = c("MolecularWeight", "CanonicalSMILES"))
This function maps compound names to PubChem CIDs using the PubChem REST API.
mapCompound2CID(names, first = FALSE, ...)mapCompound2CID(names, first = FALSE, ...)
names |
A character vector of compound names. |
first |
Logical indicating whether to return only the first CID for each compound name (default is FALSE). |
... |
Additional arguments to be passed to the getPubchemCompound function. |
A character vector of PubChem CIDs.
mapCompound2CID(c("aspirin", "caffeine"))mapCompound2CID(c("aspirin", "caffeine"))
Match inside nested elements
matchNested(x, table, ..., keep_duplicates = FALSE) ## S4 method for signature 'character,list' matchNested(x, table, keep_duplicates) ## S4 method for signature 'numeric,list' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.table' matchNested(x, table, keep_duplicates) ## S4 method for signature 'numeric,data.table' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.frame' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.frame' matchNested(x, table, keep_duplicates)matchNested(x, table, ..., keep_duplicates = FALSE) ## S4 method for signature 'character,list' matchNested(x, table, keep_duplicates) ## S4 method for signature 'numeric,list' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.table' matchNested(x, table, keep_duplicates) ## S4 method for signature 'numeric,data.table' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.frame' matchNested(x, table, keep_duplicates) ## S4 method for signature 'character,data.frame' matchNested(x, table, keep_duplicates)
x |
The values to be matched. |
table |
The values to be matched against.
Applies across rows for |
... |
Additional arguments to be passed to the method. |
keep_duplicates |
A logical value indicating whether to keep duplicates. |
Intentionally only performs exact matching. Refer to filterNested function
for partial matching support with regular expressions.
integer.
A positional vector corresponding to values defined in table the same
size as x.
showMethods("matchNested")showMethods("matchNested")
Retrieves data from the HGNC BioMart for a list of gene symbols.
query_hgnc_by_genes(genes, attributes, mart_name = NULL, dataset_name = NULL)query_hgnc_by_genes(genes, attributes, mart_name = NULL, dataset_name = NULL)
genes |
Character vector of HGNC gene symbols. |
attributes |
Character vector of attribute display names to return. |
mart_name |
Character, optional name or display name of the mart to use (default: first available mart). |
dataset_name |
Character, optional name or display name of the dataset to use (default: first available dataset). |
This function connects to the HGNC BioMart service and retrieves specified attributes for a list of gene symbols. It automatically handles the selection of marts and datasets based on provided parameters.
A data.table with results for matching gene symbols and attributes.
# Requires internet connection to HGNC BioMart if (interactive()) { query_hgnc_by_genes( genes = c("TP53", "BRCA1"), attributes = c("Approved symbol", "Approved name") ) }# Requires internet connection to HGNC BioMart if (interactive()) { query_hgnc_by_genes( genes = c("TP53", "BRCA1"), attributes = c("Approved symbol", "Approved name") ) }
This function queries the ChEMBL API using the specified parameters and returns the response in JSON format.
queryChemblAPI(resource, field, filter_type, value, format = "json")queryChemblAPI(resource, field, filter_type, value, format = "json")
resource |
The resource to query in the ChEMBL API. |
field |
The field to filter on in the ChEMBL API. |
filter_type |
The type of filter to apply in the ChEMBL API. |
value |
The value to filter on in the ChEMBL API. |
format |
The format of the response (default is "json"). |
The response from the ChEMBL API in JSON format.
# Requires the live ChEMBL service. tryCatch({ queryChemblAPI("mechanism", "molecule_chembl_id", "in", "CHEMBL1413") }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })# Requires the live ChEMBL service. tryCatch({ queryChemblAPI("mechanism", "molecule_chembl_id", "in", "CHEMBL1413") }, httr2_failure = function(e) message("ChEMBL unavailable: ", conditionMessage(e)), annotationgx_chembl_unavailable = function(e) { message("ChEMBL unavailable: ", conditionMessage(e)) })
This function queries the UniChem API for a compound based on the provided parameters.
queryUnichemCompound( compound, type, sourceID = NA_integer_, request_only = FALSE, raw = FALSE, progress = "Querying UniChem...", ... )queryUnichemCompound( compound, type, sourceID = NA_integer_, request_only = FALSE, raw = FALSE, progress = "Querying UniChem...", ... )
compound |
|
type |
|
sourceID |
|
request_only |
|
raw |
|
progress |
|
... |
Additional arguments. |
For a single query, a list with the external mappings and the UniChem
mappings. For multiple queries, a named list of such results (one per
compound). If raw = TRUE, raw responses are returned instead.
if (interactive()) { queryUnichemCompound( type = "sourceID", compound = "444795", sourceID = 22 ) }if (interactive()) { queryUnichemCompound( type = "sourceID", compound = "444795", sourceID = 22 ) }
This function takes a character vector and standardizes the names by converting them to lowercase, removing any trailing information after a comma, removing any information within square brackets or parentheses, removing any non-alphanumeric characters, replacing empty names with "invalid", and converting the names to uppercase.
standardize_names(object)standardize_names(object)
object |
A character vector containing the names to be standardized. |
A character vector with the standardized names.
standardize_names(c("John Doe", "Jane Smith (Manager)", "Alice, PhD")) # Output: [1] "JOHNDOE" "JANESMITH" "ALICE"standardize_names(c("John Doe", "Jane Smith (Manager)", "Alice, PhD")) # Output: [1] "JOHNDOE" "JANESMITH" "ALICE"
This function splits a character vector into a matrix based on a specified delimiter. It can handle both finite and infinite splits.
strSplit(x, split, fixed = TRUE, n = Inf)strSplit(x, split, fixed = TRUE, n = Inf)
x |
A character vector to be split |
split |
A character string specifying the delimiter |
fixed |
A logical value indicating whether the delimiter should be treated as a fixed string |
n |
An integer specifying the maximum number of splits to be performed |
A matrix where each row represents a split element
strSplit("Hello,World", ",") # Output: # [,1] [,2] # [1,] "Hello" "World"strSplit("Hello,World", ",") # Output: # [,1] [,2] # [1,] "Hello" "World"
This function takes a nested list as input and unlists it recursively. It then removes any NA values and duplicates from the resulting vector.
unlistNested(element)unlistNested(element)
element |
The nested list to be unlisted. |
A vector with NA values and duplicates removed.
nested_list <- list(a = list(1, 2, NA), b = list(3, 4, 5)) unlistNested(nested_list) # Output: [1] 1 2 3 4 5nested_list <- list(a = list(1, 2, NA), b = list(3, 4, 5)) unlistNested(nested_list) # Output: [1] 1 2 3 4 5