fetch.data.frame: fetch.data.frame

Description Usage Arguments Value Author(s) References Examples

View source: R/sqlshare.R

Description

Executes the given SQL statement and returns the result as a data.frame.

Usage

1
fetch.data.frame(sql, session=sqlshare.session)

Arguments

sql

A SQL statement to be executed.

session

A list containing a host, key, and user. The default is read from ~/.sqlshare/config upon loading the sqlshare package.

Value

A data.frame containing the result. A NULL is returned if the query failed due to a SQL syntax error, authentication, or missing dataset. A data.frame with no rows indicates an empty result.

Author(s)

Andrew D White

References

Information on SQLShare may be found at http://escience.washington.edu/sqlshare.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 

  #get the periodic table of elements
  sql <- "select * from [sqlshare@uw.edu].[periodic_table]"

  ## Not run: 

  #execute the sqlshare statement. Note, the extra session argument
  #isn't necessary if a config file is created
  elements <- fetch.data.frame(sql, session=guest.session)

  #plot the ionization potential as a function of atomic number
  plot(first_ionization_ev~z, elements, type="l")

  
## End(Not run)

whitead/sqlshare-r documentation built on Dec. 23, 2021, 5:13 p.m.