CartoDB: Interface to data on CartoDB
CartoDB用のインターフェイス
- CRAN: http://cran.r-project.org/web/packages/CartoDB/index.html
- GitHub: https://github.com/becarioprecario/cartodb-r
> library(CartoDB)
Loading required package: RCurl
Loading required package: bitops
Attaching package: 'RCurl'
The following object is masked from 'package:RecordLinkage':
clone
The following object is masked from 'package:ff':
clone
The following object is masked from 'package:bit':
clone
The following objects are masked from 'package:git2r':
clone, push, reset
Loading required package: RJSONIO
Loading required package: httr
Attaching package: 'httr'
The following objects are masked from 'package:git2r':
config, content
バージョン: 1.4
関数名 | 概略 |
---|---|
CartoDB-package |
R wrapper for CartoDB APIs ~~ package title ~~ |
cartodb |
CartoDB connection setup |
cartodb.collection |
Access data from a CartoDB table |
cartodb.df |
Executes a raw SQL statement and returns a dataframe response |
cartodb.maps.base |
Turns the user supplied options into the base urls needed for Maps API calls. |
cartodb.maps.link |
Given a table name and optional SQL and style parameters, returns the link of the embed URL |
cartodb.row.get |
Access a single record from CartoDB |
cartodb.row.insert |
Insert a single record into CartoDB |
cartodb.row.update |
Update a single record in CartoDB |
cartodb.spatial.dm |
Given a table, it can return the upper half of a spatial matrix in meters |
cartodb.sql.base |
Turns the user supplied options into the base urls needed for SQL API calls. |
cartodb.sql.fromParams |
Turns parameters into valid SQL for CartoDB queries |
cartodb.test |
Tests that cartodb connection is valid |
cartodb.tiles.base |
Turns the user supplied options into the base urls needed for Maps API calls. |
cartodb.tiles.tile |
Given a set of XYZ can get a tile with rendered data. |
cartodb.transformGeom |
Transform the_geom column SQL |
r2cartodb |
r2cartodb: a function to import data to your CartoDB account. |
cartodb
CartoDBとの接続。パッケージ関数の利用にはcartodb()
の実行が必要になる。
> cartodb(account.name, api.key = NULL)
cartodb.test
CartoDBへの接続が正常にできているかを検証
> cartodb.test()
> # success
> # 1 TRUE
cartodb.collection
CartoDBのテーブルからデータを取得する
Arguments
- name
- colnums
- geomAs
- omitNull
- limit
- sql
- method
- urlOnly
> cartodb.collection("table_name")
> cartodb.collection("monarch", limit = 10)
cartodb.df
データセットに対してSQLを実行する
> cartodb.df(sql = "SELECT 1")
r2cartodb
Rオブジェクト(データセット)をCartoDBへエクスポート
> r2cartodb(obj, layer_name)