labkey.deleteRows {Rlabkey}R Documentation

Delete rows of data from a labkey database

Description

Specify rows of data to be deleted from the database.

Usage

labkey.deleteRows(baseUrl, folderPath, schemaName, queryName, toDelete, 
stripAllHidden = TRUE)

Arguments

baseUrl a string specifying the baseUrlfor labkey server
folderPath a string specifying the folderPath
schemaName a string specifying the schemaName for the query
queryName a string specifying the queryName
toDelete a data frame containing a single column of data containing the data identifiers of the rows to be deleted
stripAllHidden (optional) a logical value indicating whether or not to return data columns that would normally be hidden from user veiw. If no value is specified, no hidden columns are returned.

Details

A single row or multiple rows of data can be deleted. The toDelete data frame should consist of a single column of data containing the data identifiers of the rows to be deleted (e.g., key or lsid). The name of the data in the data frame must be the column name from the labkey database. The data frame must be created with the stringsAsFactors set to FALSE.

NOTE: Each variable in a dataset has both a column label and a column name. The column label is visible at the top of each column on the web page and is longer and more descriptive. The column name is shorter and is used “behind the scenes” for database manipulation. It is the column name that must be used in the Rlabkey functions when a column name is expected. To identify a particular column name in a dataset on a web site, use the “export to R script” option available as a drop down option under the “views” tab for each dataset.

Value

A list is returned with named categories of command, rowsAffected, rows, queryName, containerPath and schemaName. The schemaName, queryName and containerPath properties contain the same schema, query and folder path used in the request. The rowsAffected property indicates he number of rows affected by the API action. This will typically be the same number as passed in the request. The rows property contains a list of rows corresponding to the rows deleted.

Author(s)

Valerie Obenchain

References

http://www.omegahat.org/RCurl/,
http://dssm.unipa.it/CRAN/web/packages/rjson/rjson.pdf,
https://www.labkey.org/project/home/begin.view

See Also

labkey.selectRows, labkey.executeSql, makeFilter, labkey.insertRows, labkey.updateRows

Examples

## Insert, update and delete
# Note that users must have the necessary permissions in the database
# to be able to modify data through the use of these functions

### Not run
#newrow <- data.frame(name="Frank", age=11, stringsAsFactors=FALSE)
#labkey.insertRows(
#baseUrl="https://atlas-test.scharp.org/cpas", 
#folderPath="/CHAVI/Analysis/vobencha", 
#schemaName="lists", 
#queryName="testlist", 
#toInsert=newrow)
#
#updaterow=data.frame(Key=4,name="Patty",age=11, stringsAsFactors=FALSE)
#mydata <- labkey.updateRows(
#baseUrl="https://atlas-test.scharp.org/cpas", 
#folderPath="/CHAVI/Analysis/vobencha", 
#schemaName="lists", 
#queryName="testlist", 
#toUpdate=updaterow)
#
#deleterow <- data.frame(Key=1, stringsAsFactors=FALSE)
#mydata <- labkey.deleteRows(
#baseUrl="https://atlas-test.scharp.org/cpas", 
#folderPath="/CHAVI/Analysis/vobencha", 
#schemaName="lists", 
#queryName="testlist", 
#toDelete=deleterow)


[Package Rlabkey version 0.0.4 Index]