Package 'rYoutheria'

Title: Access to the YouTheria Mammal Trait Database
Description: A programmatic interface to web-services of YouTheria. YouTheria is an online database of mammalian trait data <http://www.utheria.org.uk/>.
Authors: Tom August
Maintainer: Tom August <[email protected]>
License: MIT + file LICENSE
Version: 1.1.0
Built: 2024-11-12 05:42:13 UTC
Source: https://github.com/biologicalrecordscentre/ryoutheria

Help Index


Get country names from YouTheria

Description

Retrieves a data.frame of country names and IDs from YouTheria.

Usage

getCountries()

Value

A dataframe of country names and IDs. These names can be used in getMeasurementData to restrict the search to a specific country

Examples

## Not run: 
# Get a dataframe of all countries
getCountries()

## End(Not run)

Get location information from YouTheria

Description

Retrieves location information stored on YouTheria

Usage

getLocData(country = NULL, StudyUnitId = NULL)

Arguments

country

Character specifying the country within which to search for locations. for a list of countries used getCountries().

StudyUnitId

Numeric specifying the StudyUnitId to search for

Value

A dataframe in which each rows gives the details of a study unit

Examples

## Not run: 
# Get a dataframe of Indian study units
Indian_StudyUnits <- getLocData(country = 'India')

## End(Not run)

Get a table of trait measurements from YouTheria

Description

Retrieves a data.frame of trait measurements with facilities to select by location, species name and/or measurement type.

Usage

getMeasurementData(measurementType = NA, MSW93Binomial = NA,
  MSW05Binomial = NA, country = NULL, StudyUnitId = NULL,
  locationData = TRUE, locationOnly = FALSE, cast = TRUE,
  silent = FALSE)

Arguments

measurementType

Measurement types to collect data for. If NULL (default), all measurement types are returned. Can also be 'numeric' or 'character' (or a list of either type) and will filter by MeasurementTypeID and the measurement respectivly. MeasurementTypeIDs and names can be found using getMeasurementTypes().

MSW93Binomial

Character giving the latin name of a species (or list of species) for which measurements are required. Naming should follow Mammal Species of the World 1993.

MSW05Binomial

Character giving the latin name of a species (or list of species) for which measurements are required. Naming should follow Mammal Species of the World 2005.

country

Character specifying the country from which you wish to collect data. If NULL all data is retrieved. If specified then locationOnly is set to TRUE

StudyUnitId

Numeric specifying the StudyUnitId from which you wish to collect data. If NULL all data is retrieved

locationData

Logial dictating whether location information should be added to the output. Defualt is FALSE but is set to TRUE if either StudyUnitId or country are specified.

locationOnly

If TRUE data is only be returned if it has location information.

cast

If TRUE (default) then the data is cast so that each observation is one row in the output. If false then each observation has one row for each data element recorded (i.e. range, mean, units, etc)

silent

If TRUE progress reporting is silenced

Value

A data.frame with each row giving a trait measurement

Examples

## Not run: 
# Select measurement type by id
M14 <- getMeasurementData(14)
M22_7_2 <- getMeasurementData(c(22,7,2))

# Select measurement type by name
WM <- getMeasurementData('Wing Morphology')
WM_TN <- getMeasurementData(c('Wing Morphology','Teat Number'))

# Select by measurement type and species name
PpPr_bodymass <- getMeasurementData(measurementType = 1,
                                    MSW93Binomial = c('Pongo pygmaeus','Peroryctes raffrayana'))
                   
#Select by measurement type, species name and location
Ob_Activity_Tanz <- getMeasurementData(measurementType = 'Activity Cycle',
                                       MSW05Binomial = 'Oryx beisa',
                                       country = 'Tanzania')

## End(Not run)

Get Measurement Types

Description

Retrieves a data.frame of measurement types available from YouTheria.

Usage

getMeasurementTypes(measurementType = NULL)

Arguments

measurementType

If NULL (default), then all measurement types are returned. Can also be 'numeric' or 'character' (or a list of either type) and will filter by Id and Name respectivly in the resulting data.frame.

Value

A dataframe of measurement types giving their Id and Name

Examples

## Not run: 
# Get a dataframe of all measurement types
AllMT <- getMeasurementTypes()

# Seach by name
BM_MT <- getMeasurementTypes('Body Mass')
BM_LL_MT <- getMeasurementTypes(c('Body Mass','Limb Length'))

# Search by ID
MT1 <- getMeasurementTypes(1)
MT123 <- getMeasurementTypes(1:3)

## End(Not run)

The rYoutheria package

Description

The rYouTheria package harnesses the YouTheria wedsite's APIs to give easy access to a large amount of mammal trait data. The package allows the user to select data by species, location and measurement type. More information can be found out about the YouTheria dataset at http://www.utheria.org/

Click on the index link below for more information on each function


Convert data returned from API to a dataframe

Description

Takes the list returned by fromJSON(getURL(url)), where url is the ValueByType controller in the YouTheria API, and returns a data.frame. This code is faster than using plyr.

Usage

YoutheriaToDF(x)

Arguments

x

a list of trait data as returned by fromJSON(getURL(url)).

Value

A data.frame of melted trait data