Download the Rmarkdown file that created this page using the Code button above
Here’s how to add new sites to the choptank database.
Make sure you are connected to the database.
The list of current sites on this site is updated manually. To get the most up to date information, read directly from the database. The following code will query the database and make a dataframe called sites
sites <- dbGetQuery(db, "SELECT * FROM odm2.samplingfeatures WHERE samplingfeaturetypecv = 'Site'")
RS-DBI driver warning: (unrecognized PostgreSQL field type uuid (id:2950) in column 1)RS-DBI driver warning: (unrecognized PostgreSQL field type geometry (id:114457131) in column 7)
Add a new site with the db_describe_site
function from the lastest updates of the rodm2
package. At minimum you must supply the database connection (db
in this case), and a unique site_code
(maximum 50 characters). You can also include a longer site_name
(up to 255 characters long) and/or site_description
(up to 5000 characters long).
devtools::install_github("khondula/rodm2")
Downloading GitHub repo khondula/rodm2@master
from URL https://api.github.com/repos/khondula/rodm2/zipball/master
Installing rodm2
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \
'/private/var/folders/d7/5whj815j4n705g96f5pbwpj1mwqk25/T/RtmpYh3Vue/devtoolsdb33baa5028/khondula-rodm2-79a1985' \
--library='/Users/khondula/Library/R/3.5/library' --install-tests
* installing *source* package ‘rodm2’ ...
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (rodm2)
Reloading installed rodm2
library(rodm2)
db_describe_site(db = db, site_code = "New site code", site_name = "New site name", site_description = "New site description")
Site New site code has been entered into the samplingfeatures table.
This information will get added to the samplingfeatures table, along with a unique identier created with the uuid::UUIDgenerate()
function and will be recorded as “Site” sampling features from the controlled vocabulary (e.g. instead of “Specimen”).
Additional information about the site’s location (eg. coordinates) will be added separately with the describe_site_geom()
function, which should be ready soon.
LS0tCnRpdGxlOiAiQWRkIG5ldyBzaXRlcyB0byB0aGUgZGF0YWJhc2UiCm91dHB1dDogaHRtbF9ub3RlYm9vawotLS0KCj4gRG93bmxvYWQgdGhlIFJtYXJrZG93biBmaWxlIHR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