query | R Documentation |
This function queries the acas databse specified in the variable applicationSettings
and
returns the result as a data.frame
query(qu, globalConnect = FALSE, conn = NULL, catchError = TRUE, send,
...)
qu |
a sql query character string |
globalConnect |
should the query assume a global conn variable and return one to the global namespace? |
conn |
a database connection to use for the query instead of opening a new connection |
catchError |
logical on error throw error or return list object with success = false, message = character |
... |
expressions fed to |
A data frame result from the query
result <- query("select * from api_curve_params")
# conn
# Error: object 'conn' not found
result <- query("select * from api_curve_params", globalConnect=TRUE)
# conn
# <PostgreSQLConnection:(96699,1)>
# The globalConnect option:
# The first query using the global connect option will create a conn varable in the global namespace
system.time(result <- query("select * from api_curve_params", globalConnect=TRUE))
# user system elapsed
# 0.010 0.002 0.784
# The second query will use this global variable instead of opening a new connection, which makes subsequent queryies faster
# If the connection is expired or closes, the globalConnect option will create a new connection
system.time(result <- query("select * from api_curve_params", globalConnect=TRUE))
# user system elapsed
# 0.007 0.001 0.468
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.