match_instruments {harmonydata}R Documentation

Match Instruments Function

Description

This function takes a list of instruments, converts it to a format acceptable by the database, and matches the instruments using the 'Harmony Data API'. It returns the matched instruments.

Usage

match_instruments(instruments)

Arguments

instruments

A list of instruments to be matched.

Value

A list of matched instruments returned from the 'Harmony Data API'.

Author(s)

Ulster University [cph]

References

For more information about the 'Harmony Data API', visit: https://api.harmonydata.org/docs

Examples


instruments_list <- list(
  list(
    instrument_id = "id1",
    instrument_name = "Instrument A",
    questions = list(
      list(
        question_text = "How old are you?",
        topics = c("Age", "Demographics"),
        source_page = "https://example.com/instrumentA"
      ),
      list(
        question_text = "What is your gender?",
        topics = c("Gender", "Demographics"),
        source_page = "https://example.com/instrumentA"
      )
    )
  ),
  list(
    instrument_id = "id2",
    instrument_name = "Instrument B",
    questions = list(
      list(
        question_text = "Do you smoke?",
        topics = c("Smoking", "Health"),
        source_page = "https://example.com/instrumentB"
      )
    )
  )
)
matched_instruments <- match_instruments(instruments_list)




[Package harmonydata version 0.1.1 Index]