# 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
lkdata<- getRows(s, scobj$AllTypes) #shorthand for labkey.selectRows, all the same args apply
lkdata
lucols <- getLookups(s, scobj$AllTypes$Category) #can add fields from related queries
lucols
lucols2 <- getLookups(s, lucols[["Category/Group"]]) # keep going to other tables
cols <- c(names(scobj$AllTypes)[2:6], names(lucols)[2:4])
getRows(s, scobj$AllTypes, colSelect=paste(cols, sep=","))
## using lkOptions
## change the default column naming to be the same as used in the default labkey.data data frame in R views
## with rname, spaces and slashes are replace with underscores, and the whole name is lower cased
lkOptions<-list("colNameOpt"="rname")
srname <-getSession(baseUrl="http://localhost:8080/labkey", folderPath="/apisamples", lkOptions=lkOptions)
getRows(srname, scobj$AllTypes)
## using the curlOptions for generating debug tracesof network traffic
d<- debugGatherer()
copt <- curlOptions(debugfunction=d$update, verbose=TRUE, cookiefile='/cooks.txt')
sdbg<- getSession(baseUrl="http://localhost:8080/labkey", folderPath="/apisamples",
curlOptions=copt)
getRows(sdbg, scobj$AllTypes)
strwrap(d$value(), 100)
Run the code above in your browser using DataLab