labkey.domain.createAndLoad: Create a new LabKey domain and load data

View source: R/labkey.domain.R

labkey.domain.createAndLoadR Documentation

Create a new LabKey domain and load data

Description

Create a domain of the type specified by the domainKind. A LabKey domain represents a table in a specific schema. Once the domain is created the data from the data frame will be imported.

Usage

labkey.domain.createAndLoad(baseUrl=NULL, folderPath,
    name, description="", df, domainKind, options=NULL, schemaName=NULL)

Arguments

baseUrl

a string specifying the baseUrl for the labkey server

folderPath

a string specifying the folderPath

name

a string specifying the name of the domain to create

description

(optional) a string specifying the domain description

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.

domainKind

a string specifying the type of domain to create

options

(optional) a list containing options specific to the domain kind

schemaName

(optional) a string specifying the schema name to import the data into

Details

Will create a domain of the specified domain type, valid types are

  • "IntList": A list with an integer key field

  • "VarList": A list with a string key field

  • "StudyDatasetVisit": A dataset in a visit based study

  • "StudyDatasetDate": A dataset in a date based study

  • "IssueDefinition": An issue list domain

  • "SampleSet": Sample set

  • "DataClass": Data class

The options parameter should contain a list of attributes that are specific to the domain kind specified. The list of valid options for each domain kind are:

  • IntList and VarList

    • keyName (required) : The name of the field in the domain design which identifies the key field

  • StudyDatasetVisit and StudyDatasetDate

    • datasetId : Specifies a dataset ID to use, the default is to auto generate an ID

    • categoryId : Specifies an existing category ID

    • categoryName : Specifies an existing category name

    • demographics : (TRUE | FALSE) Determines whether the dataset is created as demographic

    • keyPropertyName : The name of an additional key field to be used in conjunction with participantId and (visitId or date) to create unique records

    • useTimeKeyField : (TRUE | FALSE) Specifies to use the time portion of the date field as an additional key

  • IssueDefinition

    • providerName : The type of issue list to create (IssueDefinition (default) or AssayRequestDefinition)

    • singularNoun : The singular name to use for items in the issue definition (defaults to issue)

    • pluralNoun : The plural name (defaults to issues)

  • SampleSet

    • idCols : The columns to use when constructing the concatenated unique ID. Can be up to 3 numeric IDs which represent the zero-based position of the fields in the domain.

    • parentCol : The column to represent the parent identifier in the sample set. This is a numeric value representing the zero-based position of the field in the domain.

    • nameExpression : The name expression to use for creating unique IDs

  • DataClass

    • sampleSet : The ID of the sample set if this data class is associated with a sample set.

    • nameExpression : The name expression to use for creating unique IDs

Value

A list containing the newly uploaded data frame rows.

Author(s)

Karl Lum

See Also

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

Examples

## Not run: 

library(Rlabkey)

## Prepare a data.frame
participants = c("0001","0001","0002","0002","0007","0008")
Visit = c("V1", "V2", "V2", "V1", "V2", "V1")
IntValue = c(256:261)
dataset = data.frame("ParticipantID" = participants, Visit,
    "IntegerValue" = IntValue, check.names = FALSE)

## Create the dataset and import
labkey.domain.createAndLoad(baseUrl="http://labkey", folderPath="home",
    name="demo dataset", df=dataset, domainKind="StudyDatasetVisit")

## End(Not run)

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