R: Helper function to create a domain design data structure

labkey.domain.createDesign {Rlabkey} | R Documentation

## Helper function to create a domain design data structure

### Description

Create a domain design data structure which can then be used by `labkey.domain.create` or `labkey.domain.save`

### Usage

    labkey.domain.createDesign(name, description = NULL, fields, indices = NULL)

### Arguments

`name` | a string specifying the name of the domain
`description` | (optional) a string specifying domain description
`fields` | a list containing the fields of the domain design, this should be in the same format as returned by `labkey.inferFields`.
`indices` | (optional) a list of indices definitions to be used for this domain design on creation

### Details

This is a function which can be used to create a domain design data structure. Domain designs are used both when creating a new domain or updating an existing domain.

### Value

A list containing elements describing the domain design. Any of the APIs which take a domain design parameter can accept this data structure.

### Author(s)

Karl Lum

### See Also

`labkey.domain.get`, `labkey.domain.inferFields`, `labkey.domain.createIndices`, `labkey.domain.create`, `labkey.domain.save`, `labkey.domain.drop`, `labkey.domain.createConditionalFormat`, `labkey.domain.createConditionalFormatQueryFilter`, `labkey.domain.FILTER_TYPES`

### Examples

    ## create a data frame and infer it's fields, then create a domain design from it
    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)
    indices = labkey.domain.createIndices(list("ptid", "age"), TRUE)
    indices = labkey.domain.createIndices(list("age"), FALSE, indices)
    dd <- labkey.domain.createDesign(name="test list", fields=fields, indices=indices)

[Package Rlabkey version 2.7.0 Index]