get_smarter_samples: Get SMARTER Samples

Description Usage Arguments Value Passing additional parameters Examples

View source: R/samples.R

Description

Fetch SMARTER REST API samples endpoint and returns results in a dataframe. Cached token is used or a new token is generated if not provided when calling this function (see get_smarter_token for more information)

Usage

1
get_smarter_samples(species, query = list(), token = NULL)

Arguments

species

A smarter species ("Goat", "Sheep")

query

a list of query arguments

token

a string with a valid token

Value

Returns a dataframe with selected samples

Passing additional parameters

Samples endpoint supports additional parameters when making queries. Additional parameters need to be passed as list using the query parameter. For example, to get all the "foreground" samples you need to provide list(type="foreground") as query parameter. Endpoint supports a lot of parameters and some of them can be provided multiple times See Swagger Samples endpoint for more information about the samples endpoint

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
italian_sheeps <- get_smarter_samples(
  "Sheep",
  query = list(country = "Italy")
)

merino_sheeps <- get_smarter_samples("Sheep", query = list(breed = "Merino"))

selected_goats <- get_smarter_samples(
  "Goat",
  query = list(country = "Italy", breed_code = "ORO", breed_code = "GAR")
)
## Not run: 

foreground_goats <- get_smarter_samples(
  "Goat",
  query = list(type = "foreground")
)

all_sheep_samples <- get_smarter_samples("Sheep")

## End(Not run)

cnr-ibba/r-smarter-api documentation built on Jan. 14, 2022, 9:42 p.m.