ftRtools is a package of internal FT Data Science tools for R.
To use the redshift query elements of this package you need Java SE
JDK
installed. To install the package from Github use install_github
function from the devtools
package.
devtools::install_github("Financial-Times/ftRtools")
To access FT Redshift you will need to use your credentials and be on the FT network. Do not hard code you username and password into files using these tools. Instead, use one of the available alternatives, two of which are described below.
One way to save your
credentials
is in a .Renviron
file in your home directory and to include
.Renviron
in your .gitignore
. These variable can be accessed using
Sys.getEnv()
as follows:
redshift_query("my_query.sql",
"int",
Sys.getenv("username"),
Sys.getenv("password"))
For more information on the .Renviron
file, see
here
If you are working in RStudio, you can use the RStudio API as follows.
redshift_query("my_query.sql",
"int",
rstudioapi::askForPassword("username"),
rstudioapi::askForPassword("password"))
Bear in mind that if using this method, you will need to input your credentials every time you run this code.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.