SDA_query(soilDB)
SDA_query()所属R语言包:soilDB
Soil Data Access Query
土壤数据访问查询
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Submit a query to the Soil Data Acccess (SDA) website in SQL, get the results as a dataframe.
提交的的土壤数据Acccess(SDA)的网站在SQL的查询,得到的结果作为一个数据框。
用法----------Usage----------
SDA_query(q)
参数----------Arguments----------
参数:q
a text string containing valid SQL
一个文本字符串,其中包含有效的SQL
Details
详细信息----------Details----------
The SDA website can be found at http://sdmdataaccess.nrcs.usda.gov and query examples can be found at http://sdmdataaccess.nrcs.usda.gov/QueryHelp.aspx
SDA网站上可以找到在http://sdmdataaccess.nrcs.usda.gov和查询的例子可以发现,在http://sdmdataaccess.nrcs.usda.gov/QueryHelp.aspx
值----------Value----------
A dataframe containing the results.
一个数据框包含的结果。
注意----------Note----------
This function requires the 'SSOAP' (http://www.omegahat.org/SSOAP/), 'RCurl' (http://www.omegahat.org/RCurl/) and 'XML' (http://www.omegahat.org/RSXML/) packages. You may also need the "XMLSchema" package: install.packages("XMLSchema", repos = "http://www.omegahat.org/R", type = "source"). Alternatively, Windows binary packages can be found here http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.14/. This function has been successfully tested on all Windows, MacOS, and Linux using SSOAP 0.8-1, XMLSchema 0.6-0, and XML 3.7-1.
此功能需要“SSOAP”(http://www.omegahat.org/SSOAP/),“RCurl”(http://www.omegahat.org/RCurl/)和“XML”上(http://www。 omegahat.org / RSXML /)封装。您可能还需要“的XMLSchema包:install.packages("XMLSchema", repos = "http://www.omegahat.org/R", type = "source")。此外,Windows二进制包可以在这里找到http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.14/。此功能已经成功测试了在所有的Windows,MacOS和Linux的使用,XMLSCHEMA SSOAP 0.8-1 0.6-0,和XML 3.7-1。
(作者)----------Author(s)----------
Dylan E. Beaudette
参考文献----------References----------
<h3>See Also</h3>
实例----------Examples----------
# NASIS export metadata:[大受纳粹分子欢迎导出元数据:]
## Not run: [#不运行:]
res <- SDA_query('select areasymbol, exportcertdate from distlegendmd order by areasymbol')
res$exportcertdate <- as.Date(as.POSIXct(res$exportcertdate, format="%m/%d/%Y %H:%M:%S"))
recently_updated <- res$areasymbol[res$exportcertdate > as.Date('2011-01-01')]
## End(Not run)[#(不执行)]
# basic query:[基本查询:]
## Not run: [#不运行:]
res <- SDA_query("select cokey, compname, comppct_r
from component
where compname = 'yolo' and majcompflag = 'Yes' ")
## End(Not run)[#(不执行)]
# get tabular data based on result from spatial query:[表格数据根据空间查询的结果:]
## Not run: [#不运行:]
# bbox[BBOX]
b <- c(-120.9,37.7,-120.8,37.8)
# get map unit keys for this bbox[这BBOX图单位键]
m <- MUKEYS_by_ll_bbox(b)
# make an SQL-compliant "in" statment[的SQL兼容“,在”说明书]
in.statement <- format_SQL_in_statement(m)
# format query:[格式的查询:]
q <- paste("SELECT component.cokey, compname, comppct_r, hzdept_r, hzdepb_r, hzname, sandtotal_r, silttotal_r, claytotal_r
FROM component JOIN chorizon ON component.cokey = chorizon.cokey
WHERE majcompflag = 'Yes' AND mukey IN ", in.statement, "ORDER BY cokey, comppct_r DESC, hzdept_r ASC", sep="")
# now get component and horizon-level data for these map unit keys[现在为这些图单位键的分量和水平数据]
res <- SDA_query(q)
## End(Not run)[#(不执行)]
# get component-level data for a specific soil survey area (Yolo county, CA)[组件级的数据为特定的土壤调查区(Yolo县,CA)]
## Not run: [#不运行:]
q <- "SELECT
component.mukey, cokey, comppct_r, compname, taxclname, taxorder, taxsuborder, taxgrtgroup, taxsubgrp
FROM legend
INNER JOIN mapunit ON mapunit.lkey = legend.lkey
LEFT OUTER JOIN component ON component.mukey = mapunit.mukey
WHERE legend.areasymbol = 'CA113'"
res <- SDA_query(q)
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|