Accessing multiple queries in R View | Jon (LabKey DevOps) | 2016-01-15 22:07 |
Status: Closed | ||
Hi Laura, My mistake, I had thought you were running these queries in a standalone version of R rather than within the R View Builder. So I was able to run a similarly designed query within a newly created R view like this: ######################## # This sample code returns the query data in tab-separated values format, which LabKey then # renders as HTML. Replace this code with your R script. See the Help tab for more details. write.table(labkey.data, file = "${tsvout:tsvfile}", sep = "\t", qmethod = "double", col.names=NA) library(Rlabkey) # Select rows into a data frame called 'mydata' mydata <- labkey.selectRows( baseUrl="https://www.labkey.org", folderPath="/Support Tickets/Dashboards/JonY", schemaName="lists", queryName="ListTest2", viewName="", colFilter=NULL, containerFilter=NULL ) write.table(mydata, file = "${tsvout:tsvfile}", sep = "\t", qmethod = "double", col.names=NA) ######################## For the second query to work, I had to have library(Rlabkey) being called within it. But that along with the write.table() function allowed my existing table from "labkey.data" and my other table as "mydata" appeared on the view tab successfully. Also, the version of R on the server I tested this against is on the latest version with the latest version of Rlabkey as well. I would recommend upgrading your version of R and upgrade your Rlabkey package on the server, then giving the query another try and making sure you load the Rlabkey library within your script. Give this a try and let us know how it goes. Regards, Jon |
||