Hi,
I have an R script that queries an external data source (through jdbc, not labkey.xml) and would like to display the resulting dataframe as a data grid in labkey. I want the data to be dynamically loaded - that is, the query runs each time the report is viewed. I'm thinking this should be straightforward, but not quite seeing how to do it.
For example:
result<- dbGetQuery(con, sql)
# ${htmlout:csvfile}
write(unlist(result), file="csvfile")
will output the result text in the report tab, but not as a grid.
If I don't "unlist", I get an error:
Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"), :
argument 1 (type 'list') cannot be handled by 'cat'"
because write expects an atomic list, I guess.
Any thoughts on how to wrangle the dataframe into a Data Grid?
Thanks