labkey.domain.inferFields: Infer field metadata from a data frame

View source: R/labkey.domain.R

labkey.domain.inferFieldsR Documentation

Infer field metadata from a data frame

Description

Generate field information from the specified data frame. The resulting list can be used to create or edit a domain using the labkey.domain.create or labkey.domain.save APIs.

Usage

labkey.domain.inferFields(baseUrl = NULL, folderPath, df)

Arguments

baseUrl

a string specifying the baseUrl for the labkey server

folderPath

a string specifying the folderPath

df

a data frame specifying fields to infer. The data frame must have column names as well as row data to infer the type of the field from.

Details

Field information can be generated from a data frame by introspecting the data associated with it along with other properties about that column. The data frame is posted to the server endpoint where the data is analyzed and returned as a list of fields each with it's associated list of properties and values. This list can be edited and/or used to create a domain on the server.

Value

The inferred metadata will be returned as a list with an element called : "fields" which contains the list of fields inferred from the data frame. Each field will contain the list of attributes and values for that field definition.

Author(s)

Karl Lum

See Also

labkey.domain.get, labkey.domain.create, labkey.domain.createDesign, labkey.domain.createIndices, labkey.domain.save, labkey.domain.drop

Examples

## Not run: 

## create a data frame and infer it's fields
library(Rlabkey)

df <- data.frame(ptid=c(1:3), age = c(10,20,30), sex = c("f", "m", "f"))
fields <- labkey.domain.inferFields(baseUrl="http://labkey/", folderPath="home", df=df)


## End(Not run)

Rlabkey documentation built on Oct. 23, 2024, 5:06 p.m.