R: Retrieve data from LabKey Server

getRows {Rlabkey} | R Documentation

## Retrieve data from LabKey Server

### Description

Retrive rows from a LabKey Server given a session and query object

### Usage

    getRows(session, query, maxRows=NULL, colNameOpt='fieldname', ...)

### Arguments

`session` | the session key returned from getSession
`query` | an object representing a query on LabKey Server, a child object of the object returned by `getSchema()`
`maxRows` | (optional) an integer specifying how many rows of data to return. If no value is specified, all rows are returned.
`colNameOpt` | (optional) controls the name source for the columns of the output dataframe, with valid values of 'caption', 'fieldname', and 'rname'
`...` | Any of the remaining options to `link{labkey.selectRows}`

### Details

This function works as a shortcut wrapper to `labkey.selectRows`. All of the arguments are the same as documented in labkey.selectRows.

See `labkey.selectRows` for a discussion of the valid options and defaults for `colNameOpt`. Note in particular that with getRows the default is 'fieldname' instead of 'caption'.

### Value

A data frame containing the query results corresponding to the default view of the specified query.

### Author(s)

Peter Hussey

### See Also

`getSession`, `getSchema`, `getLookups`, `saveResults` `labkey.selectRows`

### Examples

    ## simple example of getting data using schema objects
    # library(Rlabkey)

    s<-getSession(baseUrl="http://localhost:8080/labkey",
        folderPath="/apisamples")
    s  # shows schemas

    scobj <- getSchema(s, "lists")
    scobj   # shows available queries

    scobj$AllTypes  ## this is the query object

    getRows(s, scobj$AllTypes)

[Package Rlabkey version 2.8.1 Index]