Skip to content
Simple R client for Treasure Data
HTML R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst
man
tests
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION
LICENSE
NAMESPACE
NEWS.md
README.md
RTD.Rproj
RTD_example.Rmd
RTD_example.html
cran-comments.md

README.md

RTD

Travis build status

RTD is an official R client for Arm Treasure Data. It aims to make it simple to handle or connect from R to TD.

Since RTD covers only basic execution on TD, we recommend to use RPresto or RJDBC for querying.

Requirements

To upload data.frame from R, there are two options:

  1. embulk
  2. bulk-import

If you want to use embulk, ensure you've installed embulk and set PATH for it.

If you want to use bulk-import, you have to install msgpack package.

install.packages("devtools") # Install devtools if needed
devtools::install_github("crowding/msgpack-r")

Or, if you run td_upload() function first time, you can install msgpack package interactively.

Install

You can install via devtools::install_github for the latest development version.

install.packages("devtools") # Install devtools if needed
devtools::install_github("chezou/RTD@v0.2.0")

Or, you can use install-github.me instead like:

source("https://install-github.me/chezou/RTD@v0.2.0")

Example

See also RTD_example.Rmd or RPubs.

library(RTD)

client <- Td(apikey=Sys.getenv("TD_API_KEY"), endpoint=Sys.getenv("TD_API_SERVER"))

# Show list of databases
list_databases(client)

# Create database
create_database(client, "test")

# Craete table
create_table(client, "test", "example")

# Delete table
delete_table(client, "test", "example")

# Upload data.frame. Target database and table will be created automatically.
td_upload(client, "test", "mtcars", mtcars)

# Drop database
delete_database(client, "test")
You can’t perform that action at this time.