Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Getting concepts into data frames

The basic process is: To bring content into R, first search the concept library for the concept you want and note its ID number. If you want to get a specific version of a concept, also note its version ID (if not specified, you will always get the latest version). Then use the commands below to retrieve concepts.


Code Block
titleGetting concepts
library(ConceptLibraryClient);

#Retrieve the latest version of a concept. You will be prompted for a username and password
copd_icd10 = ConceptLibraryClient::get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=141
);

#View the retrieved data frame
copd_icd10;

#Set your credentials so you don't have to log in for each command.
credentials = create_auth();

#Get a concept, explicitly specifying a particular version.
copd_icd10_20200602 = get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=141,
  version=392,
  auth=credentials #Supply username and password
);

#Retrieve multiple concepts into a single data frame
comorbidities_primary_care = get_concept_codes(
  url='https://conceptlibrary.saildatabank.com',
  id=c(140,142,144),
  auth=credentials
);

...