Defines functions get_labpedon_data_from_NASIS_db

Documented in get_labpedon_data_from_NASIS_db

get_labpedon_data_from_NASIS_db <- function() {
  # must have RODBC installed
    stop('please install the `RODBC` package', call.=FALSE)

  q.ncsslabpedon <- "SELECT peiidref AS peiid, upedonid, descname, taxonname, taxclname, ncsspedonlabdata_View_1.pedlabsampnum, psctopdepth, pscbotdepth, noncarbclaywtavg, claytotwtavg, le0to100, wf0175wtavgpsc, volfractgt2wtavg, cec7clayratiowtavg, labdatasheeturl, ncsspedonlabdataiid AS labpeiid 
  FROM (ncsspedonlabdata_View_1 LEFT OUTER JOIN pedon_View_1 ON ncsspedonlabdata_View_1.peiidref = pedon_View_1.peiid);"

  # setup connection local NASIS
	channel <- RODBC::odbcDriverConnect(connection="DSN=nasis_local;UID=NasisSqlRO;[email protected]")
	# exec queries
	d.labpedon <- RODBC::sqlQuery(channel, q.ncsslabpedon, stringsAsFactors=FALSE)
	# close connection
	# return a list of results

Try the soilDB package in your browser

Any scripts or data that you put into this service are public.

soilDB documentation built on Jan. 24, 2018, 1:02 a.m.