It's annoying to deal with databases. This package offers a set of functions that cover the typical needs of most GP data users, and offers functions that allow free-range access to databases. It also allows you to cache your credentials to make interactive user easier.
Install the remotes
package:
install.packages("remotes")
And then use it to install taRpan from Github:
library(remotes)
install_github("GlobalParametrics/taRpan_readonly")
Clone the repo:
git clone git@github.com:GlobalParametrics/taRpan_readonly.git
Open the taRpanReadonly.Rproj
file in the taRpan folder - this will open RStudio. Otherwise open a terminal session in the taRpan folder and run R.
Install the package with devtools::install_local(dependencies = TRUE)
or if you've already installed it, control/command + shift + b in RStudio (if there are any dependencies to install, you can get them with devtools::install_deps()
)
Load the package: library(taRpan)
You'll be asked if you want to cache your credentials. This will save your SQL database username and password in a file in your home folder for easy access later. Do this once and you won't have to enter them when you're using the package subsequently.
library(taRpan)
Cache database username and password? (y\n) y
username: gp_{user}
password: ********
Config file saved to ~/.tarpan_readonly_config
Welcome to taRpan!
Now run tarpan2_connect()
to establish a connection with your credentials. After that you can use the following functions for accessing Tarpan 2.0 resources:
tarpan2_connect
tarpan2_db_connection
tarpan2_disconnect
tarpan2_get_grid
tarpan2_get_raster
tarpan2_get_variable_range
tarpan2_get_variables
tarpan2_query
tarpan2_show_databases
tarpan2_show_schemas
tarpan2_show_tables
tarpan2_show_variables
tarpan_geographies
tarpan_geography_metadata
tarpan_geography_variables
tarpan_model_data
tarpan_variable_models
See the function documentation for reference.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.