[r-cran-jsonlite] 03/06: Import Upstream version 1.0
Andreas Tille
tille at debian.org
Wed Nov 16 08:46:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-jsonlite.
commit 0da93142e9cbf38d300c8cfc061651172f429835
Author: Andreas Tille <tille at debian.org>
Date: Wed Nov 16 09:39:35 2016 +0100
Import Upstream version 1.0
---
DESCRIPTION | 9 +-
LICENSE | 2 +-
MD5 | 160 +++++-----
NAMESPACE | 6 +-
NEWS | 21 ++
R/apply_by_pages.R | 7 +-
R/asJSON.Date.R | 4 +-
R/asJSON.POSIXt.R | 9 +-
R/asJSON.array.R | 17 +-
R/asJSON.numeric.R | 4 +-
R/asJSON.raw.R | 4 +-
R/base64.R | 43 ++-
R/collapse.R | 21 +-
R/fromJSON.R | 2 +-
R/num_to_char.R | 4 +-
R/pack.R | 12 +-
R/stream.R | 4 +-
R/toJSON.R | 5 -
build/vignette.rds | Bin 418 -> 418 bytes
inst/doc/json-aaquickstart.html | 87 +++++-
inst/doc/json-apis.Rmd | 162 +++++-----
inst/doc/json-apis.html | 244 +++++++++------
inst/doc/json-mapping.pdf | Bin 208166 -> 208166 bytes
inst/doc/json-opencpu.pdf | Bin 64127 -> 64127 bytes
inst/doc/json-paging.Rmd | 2 +-
inst/doc/json-paging.html | 85 +++++-
man/base64.Rd | 26 ++
man/flatten.Rd | 3 +-
man/fromJSON.Rd | 4 +-
man/prettify.Rd | 2 +-
man/rbind.pages.Rd | 2 +-
man/serializeJSON.Rd | 2 +-
man/stream_in.Rd | 2 +-
man/unbox.Rd | 2 +-
man/validate.Rd | 2 +-
src/Makevars | 22 +-
src/base64.c | 333 ++++++++-------------
src/base64.h | 54 ++--
src/integer64_to_na.c | 2 +-
src/num_to_char.c | 43 +--
src/push_parser.c | 2 +-
src/r-base64.c | 32 ++
src/yajl/yajl_gen.c | 2 +-
src/yajl/yajl_tree.c | 14 +-
src/yajl/yajl_version.c | 2 +-
tests/{run-all.R => testthat.R} | 2 +-
{inst/tests => tests/testthat}/flatten.R | 0
{inst/tests => tests/testthat}/helper-toJSON.R | 0
{inst/tests => tests/testthat}/issues.txt | 0
{inst/tests => tests/testthat}/readme.txt | 0
.../testthat}/test-fromJSON-NA-values.R | 0
.../tests => tests/testthat}/test-fromJSON-array.R | 0
.../testthat}/test-fromJSON-dataframe.R | 0
.../testthat}/test-fromJSON-datasets.R | 0
.../tests => tests/testthat}/test-fromJSON-date.R | 0
.../testthat}/test-fromJSON-matrix.R | 0
.../testthat}/test-libjson-escaping.R | 0
.../tests => tests/testthat}/test-libjson-large.R | 0
{inst/tests => tests/testthat}/test-libjson-utf8.R | 0
.../testthat}/test-libjson-validator.R | 0
.../tests => tests/testthat}/test-network-Github.R | 0
.../testthat}/test-serializeJSON-datasets.R | 0
.../testthat}/test-serializeJSON-functions.R | 0
.../testthat}/test-serializeJSON-types.R | 0
{inst/tests => tests/testthat}/test-toJSON-AsIs.R | 0
{inst/tests => tests/testthat}/test-toJSON-Date.R | 0
.../testthat}/test-toJSON-NA-values.R | 0
.../testthat}/test-toJSON-NULL-values.R | 0
.../tests => tests/testthat}/test-toJSON-POSIXt.R | 0
.../tests => tests/testthat}/test-toJSON-complex.R | 0
.../testthat}/test-toJSON-dataframe.R | 0
.../tests => tests/testthat}/test-toJSON-factor.R | 0
.../testthat}/test-toJSON-keep-vec-names.R | 0
.../tests => tests/testthat}/test-toJSON-logical.R | 0
.../tests => tests/testthat}/test-toJSON-matrix.R | 0
.../tests => tests/testthat}/test-toJSON-numeric.R | 36 ++-
{inst/tests => tests/testthat}/test-toJSON-raw.R | 0
.../tests => tests/testthat}/test-toJSON-zerovec.R | 0
{inst/tests => tests/testthat}/testS4.R | 0
vignettes/json-apis.Rmd | 162 +++++-----
vignettes/json-apis.Rmd.orig | 14 +-
vignettes/json-paging.Rmd | 2 +-
82 files changed, 961 insertions(+), 720 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index 64533de..885519a 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: jsonlite
-Version: 0.9.19
+Version: 1.0
Title: A Robust, High Performance JSON Parser and Generator for R
License: MIT + file LICENSE
NeedsCompilation: yes
@@ -20,7 +20,8 @@ Description: A fast JSON parser and generator optimized for statistical data
stream, validate, and prettify JSON data. The unit tests included with the
package verify that all edge cases are encoded and decoded consistently for
use with dynamic data in systems and applications.
-Suggests: curl (>= 0.5), plyr, testthat, knitr, rmarkdown, R.rsp
-Packaged: 2015-11-27 20:06:25 UTC; jeroen
+Suggests: httr, curl, plyr, testthat, knitr, rmarkdown, R.rsp
+RoxygenNote: 5.0.1
+Packaged: 2016-06-30 23:02:54 UTC; jeroen
Repository: CRAN
-Date/Publication: 2015-11-28 09:38:27
+Date/Publication: 2016-07-01 10:57:31
diff --git a/LICENSE b/LICENSE
index 71586a8..019ab7d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,2 +1,2 @@
-YEAR: 2015
+YEAR: 2016
COPYRIGHT HOLDER: Jeroen Ooms
diff --git a/MD5 b/MD5
index 648dc10..2164490 100644
--- a/MD5
+++ b/MD5
@@ -1,16 +1,16 @@
-826885e9a9cd67f4c315131c481cf63f *DESCRIPTION
-2b11af982e62e96e928587e70fe113fa *LICENSE
-5a58c9e49d90f11642db23d72b8ce327 *NAMESPACE
-e442b90763067e25312b5689f3db8bd6 *NEWS
-6392afdce07064ef77d4d49d02afb914 *R/apply_by_pages.R
+fb2adc24a9a379845683a13992f7df4d *DESCRIPTION
+91443a13b3d89ea22bfa1222461b0111 *LICENSE
+546609c67fa14f58cb9aa9d192778605 *NAMESPACE
+14973ccc37f893697327027d36271dd1 *NEWS
+63ec63f3a8c7d5b73f74cef6ec5b3044 *R/apply_by_pages.R
14bcfc61e1a010f05f4ce98f3d714e64 *R/as.scalar.R
f5128c6b69f745efe3478372c1edf744 *R/asJSON.AAAgeneric.R
8f9c49db93b95acea9964a6aeafe3f14 *R/asJSON.ANY.R
3c0c9d555f572fafe375a57b8ac3bccf *R/asJSON.AsIs.R
-d3cb1622378eee1386424dc9a6f869b8 *R/asJSON.Date.R
+1efaecae351c1fcad6b95842eeb6acbe *R/asJSON.Date.R
1c81ac6905684d593a92df6b2e4b999c *R/asJSON.NULL.R
-a268164dd6f2873d0286260f336c99e2 *R/asJSON.POSIXt.R
-5adf2b5f2203c08e2ef0f38a25a1ad6e *R/asJSON.array.R
+59496b9c4782182eceba1dfba439ddfe *R/asJSON.POSIXt.R
+92e8d2f9195c79bf66d5d021cb176771 *R/asJSON.array.R
2ffd93fe6f8f8c0bd0600cda27a9e99b *R/asJSON.character.R
b51612de3148fa36cacc82d1b856c7ad *R/asJSON.classRepresentation.R
5d732b0dce5caa77b2901ab38f730398 *R/asJSON.complex.R
@@ -21,19 +21,19 @@ b58441d8b3ee56dcf5c05aab05fedf92 *R/asJSON.int64.R
4cd5cff473a75152242c2c0c88e25245 *R/asJSON.json.R
41e3855be2ae4d4eb0f6578bfe009e0c *R/asJSON.list.R
a6072971e1167adb5d077e5d7d9c50ea *R/asJSON.logical.R
-328eead4cc7313d02a27b8260203a070 *R/asJSON.numeric.R
+be1e5d6bc3c6a2714b0dd6d25164d811 *R/asJSON.numeric.R
b376c50c91caddd8a390e256d5ed9b13 *R/asJSON.pairlist.R
-fa461eada788c9231b8f486d0449c934 *R/asJSON.raw.R
+5bd99b683f7318528d4df51454b8c2c0 *R/asJSON.raw.R
ff63b75529d018c9d22309715a6cd04e *R/asJSON.scalar.R
3a9b614527a562cef764817d5b029b62 *R/asJSON.ts.R
-af33fe6e18b089922504cd706e4c32a4 *R/base64.R
+8f86b2dcd3418310af96d41bb0cb0dcf *R/base64.R
56915a86e78a7780df73a4c32e0cd9ad *R/cleannames.R
-6fc02cc465a0cd7276a1426a0d1cb4f2 *R/collapse.R
+0b464ec1927d240f14bcea174a17e495 *R/collapse.R
441c4b477d55d6bf478c3354d5111bb5 *R/collapse_object.R
d97f2b53cacf86184caf6959d1e46152 *R/deparse_vector.R
8f4a044a90bf62da1f4233dc49aedf2c *R/fixNativeSymbol.R
22a25cd71893e904b27ec45c16f259ad *R/flatten.R
-33f443bbe70eb553a0c7c4c97017dccb *R/fromJSON.R
+34f655378048fcfdab37b48714a7dc28 *R/fromJSON.R
c0ffae30c415067ec42c0c75b5fb43d1 *R/helpfunctions.R
ddd8e726241c082235d01da679c08006 *R/is.recordlist.R
359fa06156183f02a19595b59d26ef54 *R/is.scalarlist.R
@@ -41,8 +41,8 @@ f2a790afb805eab141a57244d7ae2525 *R/list_to_vec.R
2fdf2de3abf1a95c7728bad187a454ae *R/loadpkg.R
a11832ba11c041a7278f1ab8baf591a8 *R/makesymbol.R
092b4a52b2af56d68b8e99e4b8cb9b32 *R/null_to_na.R
-e0379b523ef1d1d5608753796301590b *R/num_to_char.R
-510f85cb798a5e7a61f1fba82bdbb221 *R/pack.R
+22d468abb392eef63f8f0d94b2cf0f0c *R/num_to_char.R
+59cb3d5a6058865ab0ea6ff9f6ca89c4 *R/pack.R
ec478d3b9e438dd9b21858fce1a49801 *R/parseJSON.R
0803a4e10e819cabb638d29739b4f7f0 *R/prettify.R
bbf0a09478028541352f62ca3c1aa495 *R/print.R
@@ -53,86 +53,55 @@ a13262093fcd5fe68cdf1b6db628b5bb *R/raw_to_json.R
1dd24c1536f68288d0d4dddeb30d5fef *R/simplify.R
ba01e3e30193969a46cb9c5ba74cc769 *R/simplifyDataFrame.R
d735d795c263b8e9a6400df135a54190 *R/stop.R
-a03eca64105a2a09e234411a65e5ed4f *R/stream.R
-456003c526a090942774cde7fefba02d *R/toJSON.R
+cb189c2adfa6531936658a1fe78d8a7e *R/stream.R
+c45139420e5f25cb6238a20e41b7a385 *R/toJSON.R
241d61276b727fc1e7348dbeab742e47 *R/unbox.R
d8505e361886fc0ac03d93b26eda8626 *R/unescape_unicode.R
77465bb5bcda44fec86bbe810150618e *R/utf8conv.R
4b1ef0cb1cd0814f6950b5d1d7ffb4ee *R/validate.R
f63dc8cea8e10742970bb44db8bdd70e *R/warn_keep_vec_names.R
-95f798e237f7baced8dcd900a07f4a76 *build/vignette.rds
+2d3152b7bfdb8713d34b48d77a386334 *build/vignette.rds
c96f0a5dcfd55f6e3e13c321629cb4dc *inst/CITATION
d02344562338775bfd92f48090f8f623 *inst/doc/json-aaquickstart.R
59736f7a3e0e0f261b921bcea129edba *inst/doc/json-aaquickstart.Rmd
-43583af54063abb63a1836a375b41b04 *inst/doc/json-aaquickstart.html
-4e99d2b8c7a7580f31c1bf2ba2957a25 *inst/doc/json-apis.Rmd
-a03498e36b1a92f116b84127fa1b2854 *inst/doc/json-apis.html
-719e45223ab9bff85c709ad0e0525d91 *inst/doc/json-mapping.pdf
+625824af04ebf3e06152ac01cbb7d1eb *inst/doc/json-aaquickstart.html
+e70fb666c92784113e6d38025571928c *inst/doc/json-apis.Rmd
+95f1318e952b052d0274584fe790eacd *inst/doc/json-apis.html
+643eaf7676d58c73f83fdbf26a1069a4 *inst/doc/json-mapping.pdf
bf707572c3655753491b742bfef2fad0 *inst/doc/json-mapping.pdf.asis
41627461cb61033b6332d711e60761d8 *inst/doc/json-opencpu.R
5577cc27f9fe4d7d86faa3ca88b74f90 *inst/doc/json-opencpu.Rnw
-c0cc85bb1e3464bfc34ef878960312db *inst/doc/json-opencpu.pdf
-738b15230beaf8317aafa65920f692bc *inst/doc/json-paging.Rmd
-203f5e8307e41a4e573f219b7ef8bcc7 *inst/doc/json-paging.html
-b39b11c0272ca25f6818952bff533031 *inst/tests/flatten.R
-b1bae2329825cb18b0a1d9995714985a *inst/tests/helper-toJSON.R
-f23023e455638146ad63169f20d36803 *inst/tests/issues.txt
-71ea8e4256bf3294c409c881681a934d *inst/tests/readme.txt
-4cb91a98ddd47a10d233678ab5989d1a *inst/tests/test-fromJSON-NA-values.R
-c9f19e48a92535e5532f996cbbac02d0 *inst/tests/test-fromJSON-array.R
-27be9afc0fa79345ad41d8ad53aa7200 *inst/tests/test-fromJSON-dataframe.R
-aa7791160baad2fd7fb3597ed808348a *inst/tests/test-fromJSON-datasets.R
-d75eee473a26e82255e677ba26520784 *inst/tests/test-fromJSON-date.R
-c6b5d8bad601bfe421a138faf26b7658 *inst/tests/test-fromJSON-matrix.R
-e237a83753f070f71421b860b91e7e72 *inst/tests/test-libjson-escaping.R
-cdc6699814eaee6709c09f96e965eace *inst/tests/test-libjson-large.R
-4ca0c2309ec1ace0dfdefc9a1285df56 *inst/tests/test-libjson-utf8.R
-5397e2ea1e806a04fb51e4eb59d34fd7 *inst/tests/test-libjson-validator.R
-361c49618cf3486bd5437dd1bb41971f *inst/tests/test-network-Github.R
-cd499599d5494ca0fc5800f511409f8a *inst/tests/test-serializeJSON-datasets.R
-aeb2168457555594252b099a76bcaa2c *inst/tests/test-serializeJSON-functions.R
-97e85447387747898b1ea5840f53c81a *inst/tests/test-serializeJSON-types.R
-b84e60041fc128cb5170f10e577c9ad5 *inst/tests/test-toJSON-AsIs.R
-eb4a97b650ff522419054f5ffaf71b5d *inst/tests/test-toJSON-Date.R
-45420c7ed3efa57e9bae8a45784c7b02 *inst/tests/test-toJSON-NA-values.R
-ff5f8b6ee8ec115226bb319131e4b361 *inst/tests/test-toJSON-NULL-values.R
-4712592e3c1bc94ca3a1c67e5c253242 *inst/tests/test-toJSON-POSIXt.R
-c9de8f6eb487ce445780eb3fbbf0209e *inst/tests/test-toJSON-complex.R
-928cfa5544be5c01a6e91983f2e83e34 *inst/tests/test-toJSON-dataframe.R
-83355d4d1aa22a0616da31644b30fa7d *inst/tests/test-toJSON-factor.R
-6319bd28125018c6b955b284de617dec *inst/tests/test-toJSON-keep-vec-names.R
-5a7f74f2f51703cdae5eed433b4ed5d4 *inst/tests/test-toJSON-logical.R
-fb28c7dc5dbd33ed9c9f4cb6d2d7ab01 *inst/tests/test-toJSON-matrix.R
-0759a0a27f2346bb29cb13179ca5759d *inst/tests/test-toJSON-numeric.R
-b67ddf907b7eda8835e59b0cf944f1b3 *inst/tests/test-toJSON-raw.R
-bdad5ec4e8cd10c38cf233a8b1305daa *inst/tests/test-toJSON-zerovec.R
-609172b33786e8d3ae0dab8450d21a0a *inst/tests/testS4.R
-e635dae3629bdc8929ad6333fb490933 *man/flatten.Rd
-0f62f6e6c6685865bddaa8fc72efa0dc *man/fromJSON.Rd
-c11fc6155ec81aa0328ded58d25f9c21 *man/prettify.Rd
-a62c8f16af864d890e437afbec5b485b *man/rbind.pages.Rd
-5ffee26ad9e5d035f91677488f3d088c *man/serializeJSON.Rd
-29d3fc427815a7ea1c30d6f011a5cab4 *man/stream_in.Rd
-b061d1c30f4dc301d0dfc28cf98f1e8a *man/unbox.Rd
-70dd43a31bfbdacef6f6688f48d02cba *man/validate.Rd
-36086dda4d4fecd925d8e45f9805d25a *src/Makevars
-766384995d24d4939dae31e5d955a3bb *src/base64.c
-4dc5aee3f5803a9c71315f2d68e0d1b5 *src/base64.h
+5ec9f7aca6e4e1571ca48a584bd0ee25 *inst/doc/json-opencpu.pdf
+2b245ad669ed3dbc0f49fb1a7763cad9 *inst/doc/json-paging.Rmd
+fdc8f1d5fafd829985129b3e752e49f6 *inst/doc/json-paging.html
+15e47e80e48f2b385394679802a72c96 *man/base64.Rd
+bcf91c6277ff0d2a911eb5618039261f *man/flatten.Rd
+fb2b62ed522125920e7d86b69210606b *man/fromJSON.Rd
+546c5b5220c3a38a7bff361efc9181ec *man/prettify.Rd
+80ad64ed5a1fa78ca813589e914d1630 *man/rbind.pages.Rd
+72715d2974a489bb1f3c9442b7084ad3 *man/serializeJSON.Rd
+3e609f428082f3ac4a104fd2216a4dbf *man/stream_in.Rd
+08136ed184e3fc214a0beca079fd3925 *man/unbox.Rd
+67902601979a591b7ec1882e6e492e53 *man/validate.Rd
+ff6ad624c2ad6146d45414800cdb0397 *src/Makevars
+88726a6c144e957c0a2ef062e272bea4 *src/base64.c
+59a91d56529e6c38b9166a5f87964ab4 *src/base64.h
faea98fda8fdbb6f78697710542c0fba *src/collapse_array.c
0ae4cfc11ff20bd4930f6b106d21ba7f *src/collapse_object.c
0549413f578a2afa06df08984092ce4d *src/collapse_pretty.c
b8327031bf8e32e0ae0d18b53deb1990 *src/escape_chars.c
-f5b084b6a0394dcfb37917435d2480f3 *src/integer64_to_na.c
+6e61613866f147bcdc751b4d557f864d *src/integer64_to_na.c
ba977a53aa8e0ebd1bab8d9ba4c3276b *src/is_recordlist.c
09701a7eb31c40523d58cb06ecaba86b *src/is_scalarlist.c
2efe63deda72cbbd3ced4181899f214a *src/modp_numtoa.c
a1a97f472d00c7f705a84e96feb7d352 *src/modp_numtoa.h
b1d3deee3a4ba2960d857892991ad682 *src/null_to_na.c
-1664105ca329631102383dadd72dec79 *src/num_to_char.c
+02efd41c4780819964534b7abe62fca6 *src/num_to_char.c
5bb8438acc3c958a2724526e4a6674c2 *src/parse.c
ca491c7e763e61bf82e17b66966ecc78 *src/prettify.c
-8becd2a5c39b0f1705dc432f50d2ee87 *src/push_parser.c
+70278afaf41629b176dd623416efefc1 *src/push_parser.c
4d8d6fb9043e7306cc526f267183313c *src/push_parser.h
+eb1e4e04c5f05d171491d332d64b1404 *src/r-base64.c
cd345103e29145d011bbcfdc3b5b1fa2 *src/row_collapse.c
53dd437fe1e446226980a8e3c2f24c8a *src/validate.c
82090dc44b5da981b6b39729bbd01b30 *src/yajl/api/yajl_common.h
@@ -149,21 +118,54 @@ c283775f8a3dad48d89b6366588e1c6c *src/yajl/yajl_alloc.h
9666a608f17725d307cb6723a273ac3b *src/yajl/yajl_bytestack.h
22b4abce2656c3db32371fa2df1e256d *src/yajl/yajl_encode.c
0ddd919c7a1b2593b2cc2cdd41285aaf *src/yajl/yajl_encode.h
-23f9d3424764408da72043650700144f *src/yajl/yajl_gen.c
+9a12954b558e739bb692bb122e7070a2 *src/yajl/yajl_gen.c
0f011605c67b70bd5f54b2aeacc78e55 *src/yajl/yajl_lex.c
3ddc5742fd9bde4cc387bbae35c01236 *src/yajl/yajl_lex.h
c3b70695f8a1225a9457a501e201c4f7 *src/yajl/yajl_parser.c
3a27147e92286b52862bf17665eda478 *src/yajl/yajl_parser.h
-084ecc84d399e3a2b2227331ea145c7b *src/yajl/yajl_tree.c
-ab3de20370cc57144f8e1b449a3e2ab2 *src/yajl/yajl_version.c
-669d289a39b2e8af6c90e562d5213d11 *tests/run-all.R
+de5b3272463232192c190e379e95bddc *src/yajl/yajl_tree.c
+03d32589ebeebc7cbc7674b1f5355d29 *src/yajl/yajl_version.c
+5a8089a334d8f6c329c96eb0acf715f3 *tests/testthat.R
+b39b11c0272ca25f6818952bff533031 *tests/testthat/flatten.R
+b1bae2329825cb18b0a1d9995714985a *tests/testthat/helper-toJSON.R
+f23023e455638146ad63169f20d36803 *tests/testthat/issues.txt
+71ea8e4256bf3294c409c881681a934d *tests/testthat/readme.txt
+4cb91a98ddd47a10d233678ab5989d1a *tests/testthat/test-fromJSON-NA-values.R
+c9f19e48a92535e5532f996cbbac02d0 *tests/testthat/test-fromJSON-array.R
+27be9afc0fa79345ad41d8ad53aa7200 *tests/testthat/test-fromJSON-dataframe.R
+aa7791160baad2fd7fb3597ed808348a *tests/testthat/test-fromJSON-datasets.R
+d75eee473a26e82255e677ba26520784 *tests/testthat/test-fromJSON-date.R
+c6b5d8bad601bfe421a138faf26b7658 *tests/testthat/test-fromJSON-matrix.R
+e237a83753f070f71421b860b91e7e72 *tests/testthat/test-libjson-escaping.R
+cdc6699814eaee6709c09f96e965eace *tests/testthat/test-libjson-large.R
+4ca0c2309ec1ace0dfdefc9a1285df56 *tests/testthat/test-libjson-utf8.R
+5397e2ea1e806a04fb51e4eb59d34fd7 *tests/testthat/test-libjson-validator.R
+361c49618cf3486bd5437dd1bb41971f *tests/testthat/test-network-Github.R
+cd499599d5494ca0fc5800f511409f8a *tests/testthat/test-serializeJSON-datasets.R
+aeb2168457555594252b099a76bcaa2c *tests/testthat/test-serializeJSON-functions.R
+97e85447387747898b1ea5840f53c81a *tests/testthat/test-serializeJSON-types.R
+b84e60041fc128cb5170f10e577c9ad5 *tests/testthat/test-toJSON-AsIs.R
+eb4a97b650ff522419054f5ffaf71b5d *tests/testthat/test-toJSON-Date.R
+45420c7ed3efa57e9bae8a45784c7b02 *tests/testthat/test-toJSON-NA-values.R
+ff5f8b6ee8ec115226bb319131e4b361 *tests/testthat/test-toJSON-NULL-values.R
+4712592e3c1bc94ca3a1c67e5c253242 *tests/testthat/test-toJSON-POSIXt.R
+c9de8f6eb487ce445780eb3fbbf0209e *tests/testthat/test-toJSON-complex.R
+928cfa5544be5c01a6e91983f2e83e34 *tests/testthat/test-toJSON-dataframe.R
+83355d4d1aa22a0616da31644b30fa7d *tests/testthat/test-toJSON-factor.R
+6319bd28125018c6b955b284de617dec *tests/testthat/test-toJSON-keep-vec-names.R
+5a7f74f2f51703cdae5eed433b4ed5d4 *tests/testthat/test-toJSON-logical.R
+fb28c7dc5dbd33ed9c9f4cb6d2d7ab01 *tests/testthat/test-toJSON-matrix.R
+db038fcae1b067b591c5f0506943d981 *tests/testthat/test-toJSON-numeric.R
+b67ddf907b7eda8835e59b0cf944f1b3 *tests/testthat/test-toJSON-raw.R
+bdad5ec4e8cd10c38cf233a8b1305daa *tests/testthat/test-toJSON-zerovec.R
+609172b33786e8d3ae0dab8450d21a0a *tests/testthat/testS4.R
59736f7a3e0e0f261b921bcea129edba *vignettes/json-aaquickstart.Rmd
-4e99d2b8c7a7580f31c1bf2ba2957a25 *vignettes/json-apis.Rmd
-b7f884b8f9b4306cf7af157808ec85cb *vignettes/json-apis.Rmd.orig
+e70fb666c92784113e6d38025571928c *vignettes/json-apis.Rmd
+24d3592e9e4846af8684dbb6d42612fa *vignettes/json-apis.Rmd.orig
0e019ff3da3b7378d6f356311bf8d839 *vignettes/json-mapping.Rnw.orig
bf707572c3655753491b742bfef2fad0 *vignettes/json-mapping.pdf.asis
5577cc27f9fe4d7d86faa3ca88b74f90 *vignettes/json-opencpu.Rnw
-738b15230beaf8317aafa65920f692bc *vignettes/json-paging.Rmd
+2b245ad669ed3dbc0f49fb1a7763cad9 *vignettes/json-paging.Rmd
c901571d19813378301caf291bf0f463 *vignettes/json-paging.Rmd.orig
3482b70f8858142fbce1f1f65310a696 *vignettes/precompile.R
bd5d57d6cc98bc3ae5e157fd8eaaff2b *vignettes/references.bib
diff --git a/NAMESPACE b/NAMESPACE
index f3bec2e..a7709d1 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,7 +1,9 @@
-# Generated by roxygen2 (4.1.1): do not edit by hand
+# Generated by roxygen2: do not edit by hand
S3method(print,json)
S3method(print,scalar)
+export(base64_dec)
+export(base64_enc)
export(flatten)
export(fromJSON)
export(minify)
@@ -26,6 +28,8 @@ useDynLib(jsonlite,C_is_scalarlist)
useDynLib(jsonlite,C_null_to_na)
useDynLib(jsonlite,C_row_collapse_array)
useDynLib(jsonlite,C_row_collapse_object)
+useDynLib(jsonlite,R_base64_decode)
+useDynLib(jsonlite,R_base64_encode)
useDynLib(jsonlite,R_feed_push_parser)
useDynLib(jsonlite,R_finalize_push_parser)
useDynLib(jsonlite,R_integer64_to_char)
diff --git a/NEWS b/NEWS
index a2585d7..2b8c7ee 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,24 @@
+1.0
+ - Fix always_decimal for non-whole numbres which get rounded to whole numbers
+ - Rename and export base64 encoder/decoder
+ - Fix compiler warning on Windows: don't redefine isnan() and isinf()
+ - Changed targed in Makevars to libstatyajl.a to prevent conflict with system libyajl
+ - Bump to 1.0 because this package is basically done
+
+0.9.22
+ - Fix for side effects of 'always_decimal' on Date and POSIXt integer encoding
+ - Fixed a small memory leak in the push parser (fromJSON.connection)
+ - Cleaned up Makevars
+ - Replace base64 encoder/decoder to be in-memory
+ - Special case toJSON(NULL, null = "null") now returns "null"
+
+0.9.21
+ - Add 'always_decimal' argument in toJSON for real number notation in whole number doubles.
+
+0.9.20
+ - Performance optimization for toJSON on matrices and arrays
+ - Tweak for unboxed POSIXt = "mongo" queries
+
0.9.19
- Remove the View() workaround because it causes issues in RStudio and
because the bug in utils::View has been fixed in R-patched.
diff --git a/R/apply_by_pages.R b/R/apply_by_pages.R
index a940154..bd66a99 100644
--- a/R/apply_by_pages.R
+++ b/R/apply_by_pages.R
@@ -4,19 +4,20 @@ apply_by_pages <- function(x, FUN, pagesize, verbose, ...){
npages <- nr %/% pagesize;
lastpage <- nr %% pagesize;
+ out <- as.list(rep(NA, npages + as.logical(lastpage)))
for(i in seq_len(npages)){
from <- pagesize * (i-1) + 1;
to <- pagesize * i
- FUN(x[from:to, ,drop = FALSE], ...)
+ out[[i]] <- FUN(x[from:to, ,drop = FALSE], ...)
if(verbose) cat("\rProcessed", i * pagesize, "rows...")
}
if(lastpage){
from <- nr - lastpage + 1;
- FUN(x[from:nr, ,drop = FALSE], ...)
+ out[[npages + 1]] <- FUN(x[from:nr, ,drop = FALSE], ...)
}
if(verbose) cat("\rComplete! Processed total of", nr, "rows.\n")
- invisible();
+ out
}
#this is another slightly slower implementation
diff --git a/R/asJSON.Date.R b/R/asJSON.Date.R
index 1a350a8..40be573 100644
--- a/R/asJSON.Date.R
+++ b/R/asJSON.Date.R
@@ -1,4 +1,4 @@
-setMethod("asJSON", "Date", function(x, Date = c("ISO8601", "epoch"), ...) {
+setMethod("asJSON", "Date", function(x, Date = c("ISO8601", "epoch"), always_decimal = FALSE, ...) {
# Validate argument
Date <- match.arg(Date)
@@ -11,5 +11,5 @@ setMethod("asJSON", "Date", function(x, Date = c("ISO8601", "epoch"), ...) {
)
# Dispatch to character encoding
- asJSON(output, ...)
+ asJSON(output, always_decimal = FALSE, ...)
})
diff --git a/R/asJSON.POSIXt.R b/R/asJSON.POSIXt.R
index 8931a84..caf3a44 100644
--- a/R/asJSON.POSIXt.R
+++ b/R/asJSON.POSIXt.R
@@ -1,5 +1,5 @@
setMethod("asJSON", "POSIXt", function(x, POSIXt = c("string", "ISO8601", "epoch",
- "mongo"), UTC = FALSE, digits, time_format = NULL, ...) {
+ "mongo"), UTC = FALSE, digits, time_format = NULL, always_decimal = FALSE, ...) {
# note: UTC argument doesn't seem to be working consistently maybe use ?format
# instead of ?as.character
@@ -11,12 +11,15 @@ setMethod("asJSON", "POSIXt", function(x, POSIXt = c("string", "ISO8601", "epoch
if (is(x, "POSIXlt")) {
x <- as.POSIXct(x)
}
- return(asJSON(data.frame("$date" = floor(unclass(x) * 1000), check.names = FALSE), digits = 0, ...))
+ df <- data.frame("$date" = floor(unclass(x) * 1000), check.names = FALSE)
+ if(inherits(x, "scalar"))
+ class(df) <- c("scalar", class(df))
+ return(asJSON(df, digits = 0, always_decimal = FALSE, ...))
}
# Epoch millis
if (POSIXt == "epoch") {
- return(asJSON(floor(unclass(as.POSIXct(x)) * 1000), digits = digits, ...))
+ return(asJSON(floor(unclass(as.POSIXct(x)) * 1000), digits = digits, always_decimal = FALSE, ...))
}
# Strings
diff --git a/R/asJSON.array.R b/R/asJSON.array.R
index 6be24c5..c5551bc 100644
--- a/R/asJSON.array.R
+++ b/R/asJSON.array.R
@@ -2,7 +2,6 @@ setMethod("asJSON", "array", function(x, collapse = TRUE, na = NULL, oldna = NUL
matrix = c("rowmajor", "columnmajor"), auto_unbox = FALSE, keep_vec_names = FALSE,
indent = NA_integer_, ...) {
- #validate
matrix <- match.arg(matrix);
# reset na arg when called from data frame
@@ -16,10 +15,20 @@ setMethod("asJSON", "array", function(x, collapse = TRUE, na = NULL, oldna = NUL
}
# if collapse == FALSE, then this matrix is nested inside a data frame,
- # and therefore row major is required to match dimensions
+ # and therefore row major must be forced to match dimensions
+ if(identical(matrix, "columnmajor") && collapse == FALSE){
+ return(apply(x, 1, asJSON, matrix = matrix, na = na, indent = indent + 2L, ...))
+ }
+
# dont pass auto_unbox (never unbox within matrix)
- margin <- ifelse(identical(matrix, "columnmajor") && isTRUE(collapse), length(dim(x)), 1);
- tmp <- apply(x, margin, asJSON, matrix = matrix, na = na, indent = indent + 2L, ...)
+ m <- asJSON(c(x), collapse = FALSE, matrix = matrix, na = na, ...)
+ dim(m) <- dim(x)
+ tmp <- if(length(dim(x)) == 2 && identical(matrix, "rowmajor")){
+ # Faster special case for 2D matrices
+ row_collapse(m, indent = indent + 2L)
+ } else {
+ collapse_array(m, columnmajor = identical(matrix, "columnmajor"), indent = indent)
+ }
# collapse it
if (collapse) {
diff --git a/R/asJSON.numeric.R b/R/asJSON.numeric.R
index 5acbeb3..13a916c 100644
--- a/R/asJSON.numeric.R
+++ b/R/asJSON.numeric.R
@@ -1,6 +1,6 @@
setMethod("asJSON", "numeric", function(x, digits = 5, use_signif = is(digits, "AsIs"),
na = c("string", "null", "NA"), auto_unbox = FALSE, collapse = TRUE,
- keep_vec_names = FALSE, indent = NA_integer_, ...) {
+ keep_vec_names = FALSE, indent = NA_integer_, always_decimal = FALSE, ...) {
# shiny legacy exception
if(isTRUE(keep_vec_names) && length(names(x))){
@@ -24,7 +24,7 @@ setMethod("asJSON", "numeric", function(x, digits = 5, use_signif = is(digits, "
tmp <- if(is(x, "integer64")){
integer64_to_char(x, na_as_string)
} else {
- num_to_char(x, digits, na_as_string, use_signif);
+ num_to_char(x, digits, na_as_string, use_signif, always_decimal);
}
if(isTRUE(auto_unbox) && length(tmp) == 1){
diff --git a/R/asJSON.raw.R b/R/asJSON.raw.R
index 13acb73..c48b720 100644
--- a/R/asJSON.raw.R
+++ b/R/asJSON.raw.R
@@ -5,11 +5,11 @@ setMethod("asJSON", "raw", function(x, raw = c("base64", "hex", "mongo"), ...) {
# encode based on schema
if (raw == "mongo") {
- return(asJSON(list(`$binary` = as.scalar(base64_encode(x)), `$type` = as.scalar("5"))))
+ return(asJSON(list(`$binary` = as.scalar(base64_enc(x)), `$type` = as.scalar("5"))))
} else if (raw == "hex") {
return(asJSON(as.character.hexmode(x), ...))
} else {
# no as scalar here!
- return(asJSON(base64_encode(x), ...))
+ return(asJSON(base64_enc(x), ...))
}
})
diff --git a/R/base64.R b/R/base64.R
index 7cbdb87..3b1b5cc 100644
--- a/R/base64.R
+++ b/R/base64.R
@@ -1,19 +1,32 @@
-# These functions have been taken from the base64 package by Francois Romain. It
-# was easier to copy then to import. They will not be exported
-base64_decode <- function(input) {
- stopifnot(is.character(input))
- inputtf <- tempfile()
- writeLines(input, inputtf)
- output <- tempfile()
- invisible(.Call("base64_decode_", inputtf, output))
- readBin(output, "raw", file.info(output)$size)
+#' Encode/decode base64
+#'
+#' Simple in-memory base64 encoder and decoder. Used internally for converting
+#' raw vectors to text. Interchangable with encoder from \code{base64enc} or
+#' \code{openssl} package.
+#'
+#' @param input string or raw vector to be encoded/decoded
+#' @export
+#' @rdname base64
+#' @name base64
+#' @useDynLib jsonlite R_base64_decode
+#' @examples str <- base64_enc(serialize(iris, NULL))
+#' out <- unserialize(base64_dec(str))
+#' stopifnot(identical(out, iris))
+base64_dec <- function(input) {
+ if(is.character(input)){
+ input <- charToRaw(paste(input, collapse = "\n"))
+ }
+ stopifnot(is.raw(input))
+ .Call(R_base64_decode, input)
}
-base64_encode <- function(input, linesize = 1e+09) {
+#' @export
+#' @rdname base64
+#' @useDynLib jsonlite R_base64_encode
+base64_enc <- function(input) {
+ if(is.character(input)){
+ input <- charToRaw(paste(input, collapse = "\n"))
+ }
stopifnot(is.raw(input))
- inputtf <- tempfile()
- writeBin(input, inputtf)
- output <- tempfile()
- invisible(.Call("base64_encode_", inputtf, output, as.integer(linesize)))
- return(readLines(output))
+ .Call(R_base64_encode, input)
}
diff --git a/R/collapse.R b/R/collapse.R
index 46582b4..d9eff14 100644
--- a/R/collapse.R
+++ b/R/collapse.R
@@ -3,7 +3,7 @@ collapse <- function(x, inner = TRUE, indent = 0L) {
if(is.na(indent)){
.Call(C_collapse_array, x)
} else if(isTRUE(inner)){
- .Call(C_collapse_array_pretty_inner, x, indent)
+ .Call(C_collapse_array_pretty_inner, x)
} else {
.Call(C_collapse_array_pretty_outer, x, indent)
}
@@ -13,3 +13,22 @@ collapse <- function(x, inner = TRUE, indent = 0L) {
row_collapse <- function(m, indent = NA_integer_){
.Call(C_row_collapse_array, m, indent = indent)
}
+
+
+# Iteratively collapse a high dimensional matrix / array
+# Does not perform the final collapse, which is done in asJSON.array()
+collapse_array <- function(x, columnmajor = FALSE, indent){
+ # dimensionality of the array
+ n <- length(dim(x))
+
+ # Collapse the inner vectors
+ dim <- 1:(n-1) + as.numeric(columnmajor)
+ x <- apply(x, dim, collapse, inner = TRUE, indent = indent)
+
+ # Collapse higher dimensions
+ for(i in rev(seq_along(dim(x)))[-1]) {
+ dim <- 1:(length(dim(x))-1) + as.numeric(columnmajor)
+ x <- apply(x, dim, collapse, inner = FALSE, indent = indent + 2L * i)
+ }
+ x
+}
diff --git a/R/fromJSON.R b/R/fromJSON.R
index 5c1ab87..9a8042e 100644
--- a/R/fromJSON.R
+++ b/R/fromJSON.R
@@ -36,7 +36,7 @@
#' @param na how to print NA values: must be one of 'null' or 'string'. Defaults are class specific
#' @param auto_unbox automatically \code{\link{unbox}} all atomic vectors of length 1. It is usually safer to avoid this and instead use the \code{\link{unbox}} function to unbox individual elements.
#' An exception is that objects of class \code{AsIs} (i.e. wrapped in \code{I()}) are not automatically unboxed. This is a way to mark single values as length-1 arrays.
-#' @param digits max number of decimal digits to print for numeric values. Use \code{I()} to specify significant digits.
+#' @param digits max number of decimal digits to print for numeric values. Use \code{I()} to specify significant digits. Use \code{NA} for max precision.
#' @param force unclass/skip objects of classes with no defined JSON mapping
#' @param pretty adds indentation whitespace to JSON output. Can be TRUE/FALSE or a number specifying the number of spaces to indent. See \code{\link{prettify}}
#' @param ... arguments passed on to class specific \code{print} methods
diff --git a/R/num_to_char.R b/R/num_to_char.R
index 0be4677..b1abf63 100644
--- a/R/num_to_char.R
+++ b/R/num_to_char.R
@@ -1,10 +1,10 @@
#' @useDynLib jsonlite R_num_to_char
-num_to_char <- function(x, digits = NA, na_as_string = NA, use_signif = FALSE){
+num_to_char <- function(x, digits = NA, na_as_string = NA, use_signif = FALSE, always_decimal = FALSE){
if(is.na(digits)) digits <- NA_integer_;
stopifnot(is.numeric(x))
stopifnot(is.numeric(digits))
stopifnot(is.logical(na_as_string))
- .Call(R_num_to_char, x, digits, na_as_string, use_signif)
+ .Call(R_num_to_char, x, digits, na_as_string, use_signif, always_decimal)
}
#' @useDynLib jsonlite R_integer64_to_char
diff --git a/R/pack.R b/R/pack.R
index 3456808..2488660 100644
--- a/R/pack.R
+++ b/R/pack.R
@@ -25,7 +25,7 @@ pack <- function(obj, ...) {
externalptr = NULL,
namespace = lapply(as.list(getNamespaceInfo(obj, "spec")), as.scalar),
S4 = list(class = as.scalar(as.character(attr(obj, "class"))), package = as.scalar(attr(attr(obj, "class"), "package"))),
- raw = as.scalar(base64_encode(unclass(obj))),
+ raw = as.scalar(base64_enc(unclass(obj))),
logical = as.vector(unclass(obj), mode = "logical"),
integer = as.vector(unclass(obj), mode = "integer"),
numeric = as.vector(unclass(obj), mode = "numeric"),
@@ -35,8 +35,8 @@ pack <- function(obj, ...) {
list = unname(lapply(unclass(obj), pack, ...)),
pairlist = unname(lapply(as.vector(obj, mode = "list"), pack, ...)),
closure = unname(lapply(obj, pack, ...)),
- builtin = as.scalar(base64_encode(serialize(unclass(obj), NULL))),
- special = as.scalar(base64_encode(serialize(unclass(obj), NULL))),
+ builtin = as.scalar(base64_enc(serialize(unclass(obj), NULL))),
+ special = as.scalar(base64_enc(serialize(unclass(obj), NULL))),
language = deparse(unclass(obj)),
name = deparse(unclass(obj)),
symbol = deparse(unclass(obj)),
@@ -57,7 +57,7 @@ unpack <- function(obj) {
namespace = getNamespace(obj$value$name),
externalptr = NULL,
S4 = getClass(obj$value$class, where = getNamespace(obj$value$package)),
- raw = base64_decode(obj$value),
+ raw = base64_dec(obj$value),
logical = as.logical(list_to_vec(obj$value)),
integer = as.integer(list_to_vec(obj$value)),
numeric = as.numeric(list_to_vec(obj$value)),
@@ -70,8 +70,8 @@ unpack <- function(obj) {
name = makesymbol(x = unlist(obj$value)),
expression = parse(text = obj$value),
language = as.call(parse(text = unlist(obj$value)))[[1]],
- special = unserialize(base64_decode(obj$value)),
- builtin = unserialize(base64_decode(obj$value)),
+ special = unserialize(base64_dec(obj$value)),
+ builtin = unserialize(base64_dec(obj$value)),
closure = lapply(obj$value, unpack),
stop("Switch falling through for encode.mode: ", encoding.mode)
)
diff --git a/R/stream.R b/R/stream.R
index 3b5b72f..cbb7edb 100644
--- a/R/stream.R
+++ b/R/stream.R
@@ -158,8 +158,8 @@ stream_in <- function(con, handler = NULL, pagesize = 500, verbose = TRUE, ...)
repeat {
page <- readLines(con, n = pagesize, encoding = "UTF-8")
if(length(page)){
- page <- Filter(nchar, page)
- cb(lapply(page, parseJSON))
+ cleanpage <- Filter(nchar, page)
+ cb(lapply(cleanpage, parseJSON))
if(verbose)
cat("\r Found", count, "records...")
}
diff --git a/R/toJSON.R b/R/toJSON.R
index 1e49750..07a8abe 100644
--- a/R/toJSON.R
+++ b/R/toJSON.R
@@ -18,11 +18,6 @@ toJSON <- function(x, dataframe = c("rows", "columns", "values"), matrix = c("ro
# force
x <- force(x)
- # edge case because 'null' in itself is not valid json
- if(is.null(x)){
- null <- "list"
- }
-
#this is just to check, we keep method-specific defaults
if(!missing(na)){
na <- match.arg(na)
diff --git a/build/vignette.rds b/build/vignette.rds
index 4d558b7..cc84146 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/inst/doc/json-aaquickstart.html b/inst/doc/json-aaquickstart.html
index 4ec5fbb..e415fc6 100644
--- a/inst/doc/json-aaquickstart.html
+++ b/inst/doc/json-aaquickstart.html
@@ -9,20 +9,21 @@
<meta name="generator" content="pandoc" />
-<meta name="date" content="2015-09-06" />
+
+<meta name="date" content="2016-05-09" />
<title></title>
-<script src="data:application/x-javascript,%2F%2A%21%20jQuery%20v1%2E11%2E0%20%7C%20%28c%29%202005%2C%202014%20jQuery%20Foundation%2C%20Inc%2E%20%7C%20jquery%2Eorg%2Flicense%20%2A%2F%0A%21function%28a%2Cb%29%7B%22object%22%3D%3Dtypeof%20module%26%26%22object%22%3D%3Dtypeof%20module%2Eexports%3Fmodule%2Eexports%3Da%2Edocument%3Fb%28a%2C%210%29%3Afunction%28a%29%7Bif%28%21a%2Edocument%29throw%20new%20Error%28%22jQuery%20requires%20a%20window%20with%20a%20document%22%29%3Breturn%20b%28a%29% [...]
+<script src="data:application/x-javascript;base64,LyohIGpRdWVyeSB2MS4xMS4zIHwgKGMpIDIwMDUsIDIwMTUgalF1ZXJ5IEZvdW5kYXRpb24sIEluYy4gfCBqcXVlcnkub3JnL2xpY2Vuc2UgKi8KIWZ1bmN0aW9uKGEsYil7Im9iamVjdCI9PXR5cGVvZiBtb2R1bGUmJiJvYmplY3QiPT10eXBlb2YgbW9kdWxlLmV4cG9ydHM/bW9kdWxlLmV4cG9ydHM9YS5kb2N1bWVudD9iKGEsITApOmZ1bmN0aW9uKGEpe2lmKCFhLmRvY3VtZW50KXRocm93IG5ldyBFcnJvcigialF1ZXJ5IHJlcXVpcmVzIGEgd2luZG93IHdpdGggYSBkb2N1bWVudCIpO3JldHVybiBiKGEpfTpiKGEpfSgidW5kZWZpbmVkIiE9dHlwZW9mIHdpbmRvdz93aW5kb3c6dG [...]
<meta name="viewport" content="width=device-width, initial-scale=1" />
-<link href="data:text/css,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%2F%2A%21%20normalize%2Ecss%20v3%2E0%2E2%20%7C%20MIT%20License%20%7C%20git%2Eio%2Fnormalize%20%2A%2Fhtml%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsiz [...]
-<script src="data:application/x-javascript,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%0Aif%28%22undefined%22%3D%3Dtypeof%20jQuery%29throw%20new%20Error%28%22Bootstrap%27s%20JavaScript%20requires%20jQuery%22%29%3B%2Bfunction%28a%29%7Bvar%20b%3Da%2Efn%2Ejquery%2Esplit%2 [...]
-<script src="data:application/x-javascript,%2F%2A%2A%0A%2A%20%40preserve%20HTML5%20Shiv%203%2E7%2E2%20%7C%20%40afarkas%20%40jdalton%20%40jon%5Fneal%20%40rem%20%7C%20MIT%2FGPL2%20Licensed%0A%2A%2F%0A%2F%2F%20Only%20run%20this%20code%20in%20IE%208%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%2Cb%29%7Bfunction%20c%28a%2Cb%29%7Bvar%20c%3Da%2EcreateElement%28%22p%22%29%2Cd%3Da%2EgetElementsByTagName%28%22head%22%29%5B0%5D%7C%7Ca%2Edocum [...]
-<script src="data:application/x-javascript,%2F%2A%21%20Respond%2Ejs%20v1%2E4%2E2%3A%20min%2Fmax%2Dwidth%20media%20query%20polyfill%20%2A%20Copyright%202013%20Scott%20Jehl%0A%20%2A%20Licensed%20under%20https%3A%2F%2Fgithub%2Ecom%2Fscottjehl%2FRespond%2Fblob%2Fmaster%2FLICENSE%2DMIT%0A%20%2A%20%20%2A%2F%0A%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%29%7B%22use%20strict%22%3Ba%2EmatchMedia%3Da%2EmatchMedia%7C%7Cfunction%28a%29%7Bvar [...]
+<link href="data:text/css;charset=utf-8,html%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsize%2Dadjust%3A100%25%7Dbody%7Bmargin%3A0%7Darticle%2Caside%2Cdetails%2Cfigcaption%2Cfigure%2Cfooter%2Cheader%2Chgroup%2Cmain%2Cmenu%2Cnav%2Csection%2Csummary%7Bdisplay%3Ablock%7Daudio%2Ccanvas%2Cprogress%2Cvideo%7Bdisplay%3Ainline%2Dblock%3Bvertical%2Dalign%3Abaseline%7Daudio%3Anot%28%5Bcontrols%5D%29%7Bdisplay%3Anone%3Bheight%3A0%7D%5Bhidden%5D%2Ctem [...]
+<script src="data:application/x-javascript;base64,LyohCiAqIEJvb3RzdHJhcCB2My4zLjUgKGh0dHA6Ly9nZXRib290c3RyYXAuY29tKQogKiBDb3B5cmlnaHQgMjAxMS0yMDE1IFR3aXR0ZXIsIEluYy4KICogTGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlCiAqLwppZigidW5kZWZpbmVkIj09dHlwZW9mIGpRdWVyeSl0aHJvdyBuZXcgRXJyb3IoIkJvb3RzdHJhcCdzIEphdmFTY3JpcHQgcmVxdWlyZXMgalF1ZXJ5Iik7K2Z1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0Ijt2YXIgYj1hLmZuLmpxdWVyeS5zcGxpdCgiICIpWzBdLnNwbGl0KCIuIik7aWYoYlswXTwyJiZiWzFdPDl8fDE9PWJbMF0mJjk9PWJbMV0mJmJbMl08MSl0aHJvdy [...]
+<script src="data:application/x-javascript;base64,LyoqCiogQHByZXNlcnZlIEhUTUw1IFNoaXYgMy43LjIgfCBAYWZhcmthcyBAamRhbHRvbiBAam9uX25lYWwgQHJlbSB8IE1JVC9HUEwyIExpY2Vuc2VkCiovCi8vIE9ubHkgcnVuIHRoaXMgY29kZSBpbiBJRSA4CmlmICghIXdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50Lm1hdGNoKCJNU0lFIDgiKSkgewohZnVuY3Rpb24oYSxiKXtmdW5jdGlvbiBjKGEsYil7dmFyIGM9YS5jcmVhdGVFbGVtZW50KCJwIiksZD1hLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF18fGEuZG9jdW1lbnRFbGVtZW50O3JldHVybiBjLmlubmVySFRNTD0ieDxzdHlsZT4iK2IrIjwvc3R5bGU+IixkLm [...]
+<script src="data:application/x-javascript;base64,LyohIFJlc3BvbmQuanMgdjEuNC4yOiBtaW4vbWF4LXdpZHRoIG1lZGlhIHF1ZXJ5IHBvbHlmaWxsICogQ29weXJpZ2h0IDIwMTMgU2NvdHQgSmVobAogKiBMaWNlbnNlZCB1bmRlciBodHRwczovL2dpdGh1Yi5jb20vc2NvdHRqZWhsL1Jlc3BvbmQvYmxvYi9tYXN0ZXIvTElDRU5TRS1NSVQKICogICovCgovLyBPbmx5IHJ1biB0aGlzIGNvZGUgaW4gSUUgOAppZiAoISF3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC5tYXRjaCgiTVNJRSA4IikpIHsKIWZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjthLm1hdGNoTWVkaWE9YS5tYXRjaE1lZGlhfHxmdW5jdGlvbihhKXt2YXIgYixjPWEuZG [...]
<style type="text/css">code{white-space: pre;}</style>
-<link href="data:text/css,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0A%20color%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0A%0Apre%20%2Eliteral%20%7B%0A%20color%3A%20%23990073%0A%7D%0A%0Apre%20%2Enumber%20%7B%0A%20color%3A%20%23099%3B%0A%7D%0A%0Apre%20%2Ecomment%20%7B%0A%20color%3A%20%23998%3B%0A%20font%2Dstyle%3A%20italic%0A%7D%0A%0Apre%20%2Ekeyword%20%7B%0A%20color%3A%20%23900%3B%0A%20font%2Dweight%3A%20bold%0A%7D%0A%0Apre%20%2Eidentifier%20%7B%0A%20color%3A%20rgb%280%2C%200%2C%200%29 [...]
-<script src="data:application/x-javascript,%0Avar%20hljs%3Dnew%20function%28%29%7Bfunction%20m%28p%29%7Breturn%20p%2Ereplace%28%2F%26%2Fgm%2C%22%26amp%3B%22%29%2Ereplace%28%2F%3C%2Fgm%2C%22%26lt%3B%22%29%7Dfunction%20f%28r%2Cq%2Cp%29%7Breturn%20RegExp%28q%2C%22m%22%2B%28r%2EcI%3F%22i%22%3A%22%22%29%2B%28p%3F%22g%22%3A%22%22%29%29%7Dfunction%20b%28r%29%7Bfor%28var%20p%3D0%3Bp%3Cr%2EchildNodes%2Elength%3Bp%2B%2B%29%7Bvar%20q%3Dr%2EchildNodes%5Bp%5D%3Bif%28q%2EnodeName%3D%3D%22CODE%22%29%7B [...]
+<link href="data:text/css;charset=utf-8,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0Acolor%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0Apre%20%2Eliteral%20%7B%0Acolor%3A%20%23990073%0A%7D%0Apre%20%2Enumber%20%7B%0Acolor%3A%20%23099%3B%0A%7D%0Apre%20%2Ecomment%20%7B%0Acolor%3A%20%23998%3B%0Afont%2Dstyle%3A%20italic%0A%7D%0Apre%20%2Ekeyword%20%7B%0Acolor%3A%20%23900%3B%0Afont%2Dweight%3A%20bold%0A%7D%0Apre%20%2Eidentifier%20%7B%0Acolor%3A%20rgb%280%2C%200%2C%200%29%3B%0A%7D%0Apre%20%2Estri [...]
+<script src="data:application/x-javascript;base64,CnZhciBobGpzPW5ldyBmdW5jdGlvbigpe2Z1bmN0aW9uIG0ocCl7cmV0dXJuIHAucmVwbGFjZSgvJi9nbSwiJmFtcDsiKS5yZXBsYWNlKC88L2dtLCImbHQ7Iil9ZnVuY3Rpb24gZihyLHEscCl7cmV0dXJuIFJlZ0V4cChxLCJtIisoci5jST8iaSI6IiIpKyhwPyJnIjoiIikpfWZ1bmN0aW9uIGIocil7Zm9yKHZhciBwPTA7cDxyLmNoaWxkTm9kZXMubGVuZ3RoO3ArKyl7dmFyIHE9ci5jaGlsZE5vZGVzW3BdO2lmKHEubm9kZU5hbWU9PSJDT0RFIil7cmV0dXJuIHF9aWYoIShxLm5vZGVUeXBlPT0zJiZxLm5vZGVWYWx1ZS5tYXRjaCgvXHMrLykpKXticmVha319fWZ1bmN0aW9uIGgodC [...]
<style type="text/css">
pre:not([class]) {
background-color: white;
@@ -38,6 +39,34 @@ if (window.hljs && document.readyState && document.readyState === "complete") {
+<style type="text/css">
+h1 {
+ font-size: 34px;
+}
+h1.title {
+ font-size: 38px;
+}
+h2 {
+ font-size: 30px;
+}
+h3 {
+ font-size: 24px;
+}
+h4 {
+ font-size: 18px;
+}
+h5 {
+ font-size: 16px;
+}
+h6 {
+ font-size: 12px;
+}
+.table th:not([align]) {
+ text-align: left;
+}
+</style>
+
+
</head>
<body>
@@ -52,15 +81,43 @@ code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
-img {
- max-width:100%;
- height: auto;
+img {
+ max-width:100%;
+ height: auto;
+}
+.tabbed-pane {
+ padding-top: 12px;
+}
+button.code-folding-btn:focus {
+ outline: none;
}
</style>
+
+
<div class="container-fluid main-container">
+<!-- tabsets -->
+<script src="data:application/x-javascript;base64,Cgp3aW5kb3cuYnVpbGRUYWJzZXRzID0gZnVuY3Rpb24odG9jSUQpIHsKCiAgLy8gYnVpbGQgYSB0YWJzZXQgZnJvbSBhIHNlY3Rpb24gZGl2IHdpdGggdGhlIC50YWJzZXQgY2xhc3MKICBmdW5jdGlvbiBidWlsZFRhYnNldCh0YWJzZXQpIHsKCiAgICAvLyBjaGVjayBmb3IgZmFkZSBhbmQgcGlsbHMgb3B0aW9ucwogICAgdmFyIGZhZGUgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1mYWRlIik7CiAgICB2YXIgcGlsbHMgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1waWxscyIpOwogICAgdmFyIG5hdkNsYXNzID0gcGlsbHMgPyAibmF2LXBpbGxzIiA6ICJuYXYtdGFicyI7CgogIC [...]
+<script>
+$(document).ready(function () {
+ window.buildTabsets("TOC");
+});
+</script>
+
+<!-- code folding -->
+
+
+
+
+<div class="fluid-row" id="header">
+
+
+
+
+</div>
+
<div id="getting-started-with-json-and-jsonlite" class="section level1">
<h1>Getting started with JSON and jsonlite</h1>
@@ -73,6 +130,12 @@ all.equal(mtcars, fromJSON(toJSON(mtcars)))</code></pre>
<h2>Simplification</h2>
<p>Simplification is the process where JSON arrays automatically get converted from a list into a more specific R class. The <code>fromJSON</code> function has 3 arguments which control the simplification process: <code>simplifyVector</code>, <code>simplifyDataFrame</code> and <code>simplifyMatrix</code>. Each one is enabled by default.</p>
<table>
+<colgroup>
+<col width="17%"></col>
+<col width="45%"></col>
+<col width="18%"></col>
+<col width="17%"></col>
+</colgroup>
<thead>
<tr class="header">
<th align="left">JSON structure</th>
@@ -216,6 +279,8 @@ myarray[1, , ]</code></pre>
</div>
+
+
</div>
<script>
diff --git a/inst/doc/json-apis.Rmd b/inst/doc/json-apis.Rmd
index c55d0b9..0daac40 100644
--- a/inst/doc/json-apis.Rmd
+++ b/inst/doc/json-apis.Rmd
@@ -1,6 +1,6 @@
---
title: "Fetching JSON data from REST APIs"
-date: "2015-09-06"
+date: "2016-05-09"
output:
html_document
vignette: >
@@ -34,36 +34,36 @@ paste(format(gg_issues$user$login), ":", gg_issues$title)
```
```
- [1] "idavydov : annotate(\"segment\") wrong position if limits are inverted"
- [2] "ben519 : geom_polygon doesn't make NA values grey when using continuous fill"
- [3] "has2k1 : Fix multiple tiny issues in the position classes"
- [4] "neggert : Problem with geom_bar position=fill and faceting"
- [5] "robertzk : Fix typo in geom_linerange docs."
- [6] "lionel- : stat_bar() gets confused with numeric discrete data?"
- [7] "daattali : Request: support theme axis.ticks.length.x and axis.ticks.length.y"
- [8] "sethchandler : Documentation error on %+replace% ?"
- [9] "daattali : dev version 1.0.1.9003 has some breaking changes"
-[10] "lionel- : Labels"
-[11] "nutterb : legend for `geom_line` colour disappears when `alpha` < 1.0"
-[12] "wch : scale_name property should be removed from Scale objects"
-[13] "wch : scale_details arguments in Coords should be renamed panel_scales or scale"
-[14] "wch : ScalesList-related functions should be moved into ggproto object"
-[15] "wch : update_geom_defaults and update_stat_defaults should accept Geom and Stat objects"
-[16] "wch : Make some ggproto objects immutable. Closes #1237"
-[17] "and3k : Control size of the border and padding of geom_label"
-[18] "hadley : Consistent argument order and formatting for layer functions"
-[19] "hadley : Consistently handle missing values"
-[20] "cmohamma : fortify causes fatal error"
-[21] "lionel- : Flawed `label_bquote()` implementation"
-[22] "beroe : Create alias for `colors=` in `scale_color_gradientn()`"
-[23] "and3k : hjust broken in y facets"
-[24] "joranE : Allow color bar guides for alpha scales"
-[25] "hadley : dir = \"v\" also needs to swap nrow and ncol"
-[26] "joranE : Add examples for removing guides"
-[27] "lionel- : New approach for horizontal layers"
-[28] "bbolker : add horizontal linerange geom"
-[29] "hadley : Write vignette about grid"
-[30] "hadley : Immutable flag for ggproto objects"
+ [1] "tdsmith : stat_binhex weight aesthetic is undocumented"
+ [2] "huelf : geom_contour throws error when ggplot aes uses shape"
+ [3] "davidkretch : Fix typo in Extending ggplot2 vignette"
+ [4] "janschulz : data used in geom_text with geom specific aes is longer than it should be?"
+ [5] "janschulz : Add top margin to default plot.caption"
+ [6] "wch : Preserve class when adding uneval objects"
+ [7] "coolbutuseless : corrected theme inhertiance for legend.key.size"
+ [8] "has2k1 : Fix geom_dotplot y limit calculations"
+ [9] "shreyasgm : Typo in error message while saving large plots"
+[10] "DarwinAwardWinner : Ordering of multiple legends is seemingly random"
+[11] "noamross : geom_dotplot extends past axis"
+[12] "aosmith16 : geom_dotplot negates free y scale from facet_wrap"
+[13] "lfaller : How to customize x-axis labels for a stacked bar plot graph?"
+[14] "kfeng123 : How can I axis.ticks while using theme_minimal()?"
+[15] "richardbeare : Design query - connectograms"
+[16] "gcpoole : Plotting SpatialLinesDataFrame connects all of the individual lines"
+[17] "zeehio : [Feature Request] different scales by facet"
+[18] "salauer : geom_smooth parameters no longer available in qplot"
+[19] "luczkovichj : Contour labels using direct.label"
+[20] "coolbutuseless : geom_hex/stat_hex binwidth argument no longer working"
+[21] "HughParsonage : annotate() won't expand when position aesthetics are length 1"
+[22] "whao89 : geom_hex no longer recognizes ..density.. in 2.1.0"
+[23] "paul4forest : X axis doesn't appear below facet_wrap plot with uneven number of facets"
+[24] "DarioS : Allow a Vector of Numbers for label_wrap_gen's Width Parameter"
+[25] "coolbutuseless : stat_bin_2d creates an (almost) unkillable legend."
+[26] "dutri001 : Online documentation: HTML table not properly generated from Latex doc "
+[27] "krlmlr : Conditional examples are not rendered"
+[28] "juliangehring : Facets break grouping of data points"
+[29] "holgerbrandl : segfault on macos when using ggsave in parallelized loop "
+[30] "JestonBlu : Added new economic theme"
```
## CitiBike NYC
@@ -94,7 +94,7 @@ nrow(stations)
```
```
-[1] 509
+[1] 508
```
## Ergast
@@ -191,7 +191,7 @@ filings[1:10, c("organization.sub_name", "organization.city", "totrevenue")]
## New York Times
-The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/docs/reference/keys). The code below includes some example keys for illustration purposes.
+The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/signup). The code below includes some example keys for illustration purposes.
```r
@@ -204,13 +204,13 @@ colnames(articles)
```
```
- [1] "web_url" "snippet" "lead_paragraph"
- [4] "abstract" "print_page" "blog"
- [7] "source" "multimedia" "headline"
-[10] "keywords" "pub_date" "document_type"
-[13] "news_desk" "section_name" "subsection_name"
-[16] "byline" "type_of_material" "_id"
-[19] "word_count"
+ [1] "web_url" "snippet" "lead_paragraph"
+ [4] "abstract" "print_page" "blog"
+ [7] "source" "multimedia" "headline"
+[10] "keywords" "pub_date" "document_type"
+[13] "news_desk" "section_name" "subsection_name"
+[16] "byline" "type_of_material" "_id"
+[19] "word_count" "slideshow_credits"
```
```r
@@ -242,12 +242,10 @@ colnames(reviews)
```
```
- [1] "nyt_movie_id" "display_title" "sort_name"
- [4] "mpaa_rating" "critics_pick" "thousand_best"
- [7] "byline" "headline" "capsule_review"
-[10] "summary_short" "publication_date" "opening_date"
-[13] "dvd_release_date" "date_updated" "seo_name"
-[16] "link" "related_urls" "multimedia"
+ [1] "display_title" "mpaa_rating" "critics_pick"
+ [4] "byline" "headline" "summary_short"
+ [7] "publication_date" "opening_date" "date_updated"
+[10] "link" "multimedia"
```
```r
@@ -255,12 +253,12 @@ reviews[1:5, c("display_title", "byline", "mpaa_rating")]
```
```
- display_title byline mpaa_rating
-1 Tom at the Farm Stephen Holden NR
-2 A Little Chaos Stephen Holden R
-3 Big Game Andy Webster PG13
-4 Balls Out Andy Webster R
-5 Mad Max: Fury Road A. O. Scott R
+ display_title byline mpaa_rating
+1 Dheepan A. O. SCOTT R
+2 Mothers and Daughters NEIL GENZLINGER PG-13
+3 Phantom of the Theater DANIEL M. GOLD
+4 Beautiful Something STEPHEN HOLDEN Not Rated
+5 Elstree 1976 NEIL GENZLINGER
```
## CrunchBase
@@ -289,12 +287,18 @@ print(drone_bills[1:5, c("title", "state", "chamber", "type")])
```
```
- title state chamber type
-1 WILDLIFE-TECH il lower bill
-2 Criminalizes the unlawful use of an unma ny lower bill
-3 Criminalizes the unlawful use of an unma ny lower bill
-4 Relating to: criminal procedure and prov wi lower bill
-5 Relating to: criminal procedure and prov wi upper bill
+ title state chamber
+1 An act relating to privacy protection vt upper
+2 Crimes: emergency personnel. ca lower
+3 DRONE TASK FORCE APPT il lower
+4 Omnibus K-12 and higher education policy mn lower
+5 Relates to prohibiting civilian drone us ny upper
+ type
+1 bill
+2 bill, fiscal committee, local program
+3 bill
+4 bill
+5 bill
```
```r
@@ -308,11 +312,11 @@ summary(wordcount)
```
count day raw_count
Min. : 1.00 Min. :1996-01-02 Min. : 1.00
- 1st Qu.: 3.00 1st Qu.:2001-01-22 1st Qu.: 3.00
- Median : 8.00 Median :2005-11-16 Median : 8.00
- Mean : 25.27 Mean :2005-10-02 Mean : 25.27
- 3rd Qu.: 21.00 3rd Qu.:2010-05-12 3rd Qu.: 21.00
- Max. :1835.00 Max. :2015-08-05 Max. :1835.00
+ 1st Qu.: 3.00 1st Qu.:2001-03-26 1st Qu.: 3.00
+ Median : 8.00 Median :2006-03-21 Median : 8.00
+ Mean : 24.91 Mean :2006-01-30 Mean : 24.91
+ 3rd Qu.: 21.00 3rd Qu.:2010-12-08 3rd Qu.: 21.00
+ Max. :1835.00 Max. :2016-04-27 Max. :1835.00
```
```r
@@ -340,10 +344,9 @@ consumer_key = "EZRy5JzOH2QQmVAe9B4j2w";
consumer_secret = "OIDC4MdfZJ82nbwpZfoUO4WOLTYjoRhpHRAWj6JMec";
#Use basic auth
-library(httr)
-secret <- RCurl::base64(paste(consumer_key, consumer_secret, sep = ":"));
-req <- POST("https://api.twitter.com/oauth2/token",
- add_headers(
+secret <- openssl::base64_encode(paste(consumer_key, consumer_secret, sep = ":"));
+req <- httr::POST("https://api.twitter.com/oauth2/token",
+ httr::add_headers(
"Authorization" = paste("Basic", secret),
"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8"
),
@@ -355,22 +358,21 @@ token <- paste("Bearer", content(req)$access_token)
#Actual API call
url <- "https://api.twitter.com/1.1/statuses/user_timeline.json?count=10&screen_name=Rbloggers"
-req <- GET(url, add_headers(Authorization = token))
-json <- content(req, as = "text")
+req <- httr::GET(url, add_headers(Authorization = token))
+json <- httr::content(req, as = "text")
tweets <- fromJSON(json)
substring(tweets$text, 1, 100)
```
```
- [1] "Analysing longitudinal data: Multilevel growth models (II) http://t.co/unUxszG7VJ #rstats"
- [2] "RcppDE 0.1.4 http://t.co/3qPhFzoOpj #rstats"
- [3] "Minimalist Maps http://t.co/fpkNznuCoX #rstats"
- [4] "Tutorials freely available of course I taught: including ggplot2, dplyr and shiny http://t.co/WsxX4U"
- [5] "Deploying Shiny apps with shinyapps.io http://t.co/tjef1pbKLt #rstats"
- [6] "Bootstrap Evaluation of Clusters http://t.co/EbY7ziKCz5 #rstats"
- [7] "Add external code to Rmarkdown http://t.co/RCJEmS8gyP #rstats"
- [8] "Linear models with weighted observations http://t.co/pUoHpvxAGC #rstats"
- [9] "dplyr 0.4.3 http://t.co/ze3zc8t7qj #rstats"
-[10] "xkcd survey and the power to shape the internet http://t.co/vNaKhxWxE4 #rstats"
+ [1] "Rblpapi 0.3.4 https://t.co/NoGluTGSld #rstats #DataScience"
+ [2] "Introducing DohaR – A new R User Group in Doha, Qatar https://t.co/MWSKgMap9I #rstats #DataScience"
+ [3] "FSA v0.8.7 Released https://t.co/2nnGMGINA7 #rstats #DataScience"
+ [4] "Too Much Parallelism is as Bad https://t.co/t0RffUvLYs #rstats #DataScience"
+ [5] "Coming up: principal components analysis https://t.co/f9dUnhuC9n #rstats #DataScience"
+ [6] "Shiny Apps Gallery using Plotly in R https://t.co/cEFvgy1VPY #rstats #DataScience"
+ [7] "Who is going down? Bundesliga Betting Odds – updated https://t.co/uvpcmOmcaf #rstats #DataScience"
+ [8] "BH 1.60.0-2 https://t.co/kZHVjPzG65 #rstats #DataScience"
+ [9] "Red herring bites https://t.co/IJQwBQkImx #rstats #DataScience"
+[10] "R Tools for Visual Studio 3.0 now available https://t.co/JWKthTwEnC #rstats #DataScience"
```
-
diff --git a/inst/doc/json-apis.html b/inst/doc/json-apis.html
index 1055bbc..02dff61 100644
--- a/inst/doc/json-apis.html
+++ b/inst/doc/json-apis.html
@@ -9,20 +9,21 @@
<meta name="generator" content="pandoc" />
-<meta name="date" content="2015-09-06" />
+
+<meta name="date" content="2016-05-09" />
<title>Fetching JSON data from REST APIs</title>
-<script src="data:application/x-javascript,%2F%2A%21%20jQuery%20v1%2E11%2E0%20%7C%20%28c%29%202005%2C%202014%20jQuery%20Foundation%2C%20Inc%2E%20%7C%20jquery%2Eorg%2Flicense%20%2A%2F%0A%21function%28a%2Cb%29%7B%22object%22%3D%3Dtypeof%20module%26%26%22object%22%3D%3Dtypeof%20module%2Eexports%3Fmodule%2Eexports%3Da%2Edocument%3Fb%28a%2C%210%29%3Afunction%28a%29%7Bif%28%21a%2Edocument%29throw%20new%20Error%28%22jQuery%20requires%20a%20window%20with%20a%20document%22%29%3Breturn%20b%28a%29% [...]
+<script src="data:application/x-javascript;base64,LyohIGpRdWVyeSB2MS4xMS4zIHwgKGMpIDIwMDUsIDIwMTUgalF1ZXJ5IEZvdW5kYXRpb24sIEluYy4gfCBqcXVlcnkub3JnL2xpY2Vuc2UgKi8KIWZ1bmN0aW9uKGEsYil7Im9iamVjdCI9PXR5cGVvZiBtb2R1bGUmJiJvYmplY3QiPT10eXBlb2YgbW9kdWxlLmV4cG9ydHM/bW9kdWxlLmV4cG9ydHM9YS5kb2N1bWVudD9iKGEsITApOmZ1bmN0aW9uKGEpe2lmKCFhLmRvY3VtZW50KXRocm93IG5ldyBFcnJvcigialF1ZXJ5IHJlcXVpcmVzIGEgd2luZG93IHdpdGggYSBkb2N1bWVudCIpO3JldHVybiBiKGEpfTpiKGEpfSgidW5kZWZpbmVkIiE9dHlwZW9mIHdpbmRvdz93aW5kb3c6dG [...]
<meta name="viewport" content="width=device-width, initial-scale=1" />
-<link href="data:text/css,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%2F%2A%21%20normalize%2Ecss%20v3%2E0%2E2%20%7C%20MIT%20License%20%7C%20git%2Eio%2Fnormalize%20%2A%2Fhtml%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsiz [...]
-<script src="data:application/x-javascript,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%0Aif%28%22undefined%22%3D%3Dtypeof%20jQuery%29throw%20new%20Error%28%22Bootstrap%27s%20JavaScript%20requires%20jQuery%22%29%3B%2Bfunction%28a%29%7Bvar%20b%3Da%2Efn%2Ejquery%2Esplit%2 [...]
-<script src="data:application/x-javascript,%2F%2A%2A%0A%2A%20%40preserve%20HTML5%20Shiv%203%2E7%2E2%20%7C%20%40afarkas%20%40jdalton%20%40jon%5Fneal%20%40rem%20%7C%20MIT%2FGPL2%20Licensed%0A%2A%2F%0A%2F%2F%20Only%20run%20this%20code%20in%20IE%208%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%2Cb%29%7Bfunction%20c%28a%2Cb%29%7Bvar%20c%3Da%2EcreateElement%28%22p%22%29%2Cd%3Da%2EgetElementsByTagName%28%22head%22%29%5B0%5D%7C%7Ca%2Edocum [...]
-<script src="data:application/x-javascript,%2F%2A%21%20Respond%2Ejs%20v1%2E4%2E2%3A%20min%2Fmax%2Dwidth%20media%20query%20polyfill%20%2A%20Copyright%202013%20Scott%20Jehl%0A%20%2A%20Licensed%20under%20https%3A%2F%2Fgithub%2Ecom%2Fscottjehl%2FRespond%2Fblob%2Fmaster%2FLICENSE%2DMIT%0A%20%2A%20%20%2A%2F%0A%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%29%7B%22use%20strict%22%3Ba%2EmatchMedia%3Da%2EmatchMedia%7C%7Cfunction%28a%29%7Bvar [...]
+<link href="data:text/css;charset=utf-8,html%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsize%2Dadjust%3A100%25%7Dbody%7Bmargin%3A0%7Darticle%2Caside%2Cdetails%2Cfigcaption%2Cfigure%2Cfooter%2Cheader%2Chgroup%2Cmain%2Cmenu%2Cnav%2Csection%2Csummary%7Bdisplay%3Ablock%7Daudio%2Ccanvas%2Cprogress%2Cvideo%7Bdisplay%3Ainline%2Dblock%3Bvertical%2Dalign%3Abaseline%7Daudio%3Anot%28%5Bcontrols%5D%29%7Bdisplay%3Anone%3Bheight%3A0%7D%5Bhidden%5D%2Ctem [...]
+<script src="data:application/x-javascript;base64,LyohCiAqIEJvb3RzdHJhcCB2My4zLjUgKGh0dHA6Ly9nZXRib290c3RyYXAuY29tKQogKiBDb3B5cmlnaHQgMjAxMS0yMDE1IFR3aXR0ZXIsIEluYy4KICogTGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlCiAqLwppZigidW5kZWZpbmVkIj09dHlwZW9mIGpRdWVyeSl0aHJvdyBuZXcgRXJyb3IoIkJvb3RzdHJhcCdzIEphdmFTY3JpcHQgcmVxdWlyZXMgalF1ZXJ5Iik7K2Z1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0Ijt2YXIgYj1hLmZuLmpxdWVyeS5zcGxpdCgiICIpWzBdLnNwbGl0KCIuIik7aWYoYlswXTwyJiZiWzFdPDl8fDE9PWJbMF0mJjk9PWJbMV0mJmJbMl08MSl0aHJvdy [...]
+<script src="data:application/x-javascript;base64,LyoqCiogQHByZXNlcnZlIEhUTUw1IFNoaXYgMy43LjIgfCBAYWZhcmthcyBAamRhbHRvbiBAam9uX25lYWwgQHJlbSB8IE1JVC9HUEwyIExpY2Vuc2VkCiovCi8vIE9ubHkgcnVuIHRoaXMgY29kZSBpbiBJRSA4CmlmICghIXdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50Lm1hdGNoKCJNU0lFIDgiKSkgewohZnVuY3Rpb24oYSxiKXtmdW5jdGlvbiBjKGEsYil7dmFyIGM9YS5jcmVhdGVFbGVtZW50KCJwIiksZD1hLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF18fGEuZG9jdW1lbnRFbGVtZW50O3JldHVybiBjLmlubmVySFRNTD0ieDxzdHlsZT4iK2IrIjwvc3R5bGU+IixkLm [...]
+<script src="data:application/x-javascript;base64,LyohIFJlc3BvbmQuanMgdjEuNC4yOiBtaW4vbWF4LXdpZHRoIG1lZGlhIHF1ZXJ5IHBvbHlmaWxsICogQ29weXJpZ2h0IDIwMTMgU2NvdHQgSmVobAogKiBMaWNlbnNlZCB1bmRlciBodHRwczovL2dpdGh1Yi5jb20vc2NvdHRqZWhsL1Jlc3BvbmQvYmxvYi9tYXN0ZXIvTElDRU5TRS1NSVQKICogICovCgovLyBPbmx5IHJ1biB0aGlzIGNvZGUgaW4gSUUgOAppZiAoISF3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC5tYXRjaCgiTVNJRSA4IikpIHsKIWZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjthLm1hdGNoTWVkaWE9YS5tYXRjaE1lZGlhfHxmdW5jdGlvbihhKXt2YXIgYixjPWEuZG [...]
<style type="text/css">code{white-space: pre;}</style>
-<link href="data:text/css,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0A%20color%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0A%0Apre%20%2Eliteral%20%7B%0A%20color%3A%20%23990073%0A%7D%0A%0Apre%20%2Enumber%20%7B%0A%20color%3A%20%23099%3B%0A%7D%0A%0Apre%20%2Ecomment%20%7B%0A%20color%3A%20%23998%3B%0A%20font%2Dstyle%3A%20italic%0A%7D%0A%0Apre%20%2Ekeyword%20%7B%0A%20color%3A%20%23900%3B%0A%20font%2Dweight%3A%20bold%0A%7D%0A%0Apre%20%2Eidentifier%20%7B%0A%20color%3A%20rgb%280%2C%200%2C%200%29 [...]
-<script src="data:application/x-javascript,%0Avar%20hljs%3Dnew%20function%28%29%7Bfunction%20m%28p%29%7Breturn%20p%2Ereplace%28%2F%26%2Fgm%2C%22%26amp%3B%22%29%2Ereplace%28%2F%3C%2Fgm%2C%22%26lt%3B%22%29%7Dfunction%20f%28r%2Cq%2Cp%29%7Breturn%20RegExp%28q%2C%22m%22%2B%28r%2EcI%3F%22i%22%3A%22%22%29%2B%28p%3F%22g%22%3A%22%22%29%29%7Dfunction%20b%28r%29%7Bfor%28var%20p%3D0%3Bp%3Cr%2EchildNodes%2Elength%3Bp%2B%2B%29%7Bvar%20q%3Dr%2EchildNodes%5Bp%5D%3Bif%28q%2EnodeName%3D%3D%22CODE%22%29%7B [...]
+<link href="data:text/css;charset=utf-8,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0Acolor%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0Apre%20%2Eliteral%20%7B%0Acolor%3A%20%23990073%0A%7D%0Apre%20%2Enumber%20%7B%0Acolor%3A%20%23099%3B%0A%7D%0Apre%20%2Ecomment%20%7B%0Acolor%3A%20%23998%3B%0Afont%2Dstyle%3A%20italic%0A%7D%0Apre%20%2Ekeyword%20%7B%0Acolor%3A%20%23900%3B%0Afont%2Dweight%3A%20bold%0A%7D%0Apre%20%2Eidentifier%20%7B%0Acolor%3A%20rgb%280%2C%200%2C%200%29%3B%0A%7D%0Apre%20%2Estri [...]
+<script src="data:application/x-javascript;base64,CnZhciBobGpzPW5ldyBmdW5jdGlvbigpe2Z1bmN0aW9uIG0ocCl7cmV0dXJuIHAucmVwbGFjZSgvJi9nbSwiJmFtcDsiKS5yZXBsYWNlKC88L2dtLCImbHQ7Iil9ZnVuY3Rpb24gZihyLHEscCl7cmV0dXJuIFJlZ0V4cChxLCJtIisoci5jST8iaSI6IiIpKyhwPyJnIjoiIikpfWZ1bmN0aW9uIGIocil7Zm9yKHZhciBwPTA7cDxyLmNoaWxkTm9kZXMubGVuZ3RoO3ArKyl7dmFyIHE9ci5jaGlsZE5vZGVzW3BdO2lmKHEubm9kZU5hbWU9PSJDT0RFIil7cmV0dXJuIHF9aWYoIShxLm5vZGVUeXBlPT0zJiZxLm5vZGVWYWx1ZS5tYXRjaCgvXHMrLykpKXticmVha319fWZ1bmN0aW9uIGgodC [...]
<style type="text/css">
pre:not([class]) {
background-color: white;
@@ -38,6 +39,34 @@ if (window.hljs && document.readyState && document.readyState === "complete") {
+<style type="text/css">
+h1 {
+ font-size: 34px;
+}
+h1.title {
+ font-size: 38px;
+}
+h2 {
+ font-size: 30px;
+}
+h3 {
+ font-size: 24px;
+}
+h4 {
+ font-size: 18px;
+}
+h5 {
+ font-size: 16px;
+}
+h6 {
+ font-size: 12px;
+}
+.table th:not([align]) {
+ text-align: left;
+}
+</style>
+
+
</head>
<body>
@@ -52,17 +81,43 @@ code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
-img {
- max-width:100%;
- height: auto;
+img {
+ max-width:100%;
+ height: auto;
+}
+.tabbed-pane {
+ padding-top: 12px;
+}
+button.code-folding-btn:focus {
+ outline: none;
}
</style>
+
+
<div class="container-fluid main-container">
+<!-- tabsets -->
+<script src="data:application/x-javascript;base64,Cgp3aW5kb3cuYnVpbGRUYWJzZXRzID0gZnVuY3Rpb24odG9jSUQpIHsKCiAgLy8gYnVpbGQgYSB0YWJzZXQgZnJvbSBhIHNlY3Rpb24gZGl2IHdpdGggdGhlIC50YWJzZXQgY2xhc3MKICBmdW5jdGlvbiBidWlsZFRhYnNldCh0YWJzZXQpIHsKCiAgICAvLyBjaGVjayBmb3IgZmFkZSBhbmQgcGlsbHMgb3B0aW9ucwogICAgdmFyIGZhZGUgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1mYWRlIik7CiAgICB2YXIgcGlsbHMgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1waWxscyIpOwogICAgdmFyIG5hdkNsYXNzID0gcGlsbHMgPyAibmF2LXBpbGxzIiA6ICJuYXYtdGFicyI7CgogIC [...]
+<script>
+$(document).ready(function () {
+ window.buildTabsets("TOC");
+});
+</script>
+
+<!-- code folding -->
+
+
+
+
+
+
+<div class="fluid-row" id="header">
+
+
+
+<h1 class="title toc-ignore">Fetching JSON data from REST APIs</h1>
+<h4 class="date"><em>2016-05-09</em></h4>
-<div id="header">
-<h1 class="title">Fetching JSON data from REST APIs</h1>
-<h4 class="date"><em>2015-09-06</em></h4>
</div>
@@ -78,36 +133,36 @@ gg_issues <- fromJSON("https://api.github.com/repos/hadley/ggplot2/issue
#latest issues
paste(format(gg_issues$user$login), ":", gg_issues$title)</code></pre>
-<pre><code> [1] "idavydov : annotate(\"segment\") wrong position if limits are inverted"
- [2] "ben519 : geom_polygon doesn't make NA values grey when using continuous fill"
- [3] "has2k1 : Fix multiple tiny issues in the position classes"
- [4] "neggert : Problem with geom_bar position=fill and faceting"
- [5] "robertzk : Fix typo in geom_linerange docs."
- [6] "lionel- : stat_bar() gets confused with numeric discrete data?"
- [7] "daattali : Request: support theme axis.ticks.length.x and axis.ticks.length.y"
- [8] "sethchandler : Documentation error on %+replace% ?"
- [9] "daattali : dev version 1.0.1.9003 has some breaking changes"
-[10] "lionel- : Labels"
-[11] "nutterb : legend for `geom_line` colour disappears when `alpha` < 1.0"
-[12] "wch : scale_name property should be removed from Scale objects"
-[13] "wch : scale_details arguments in Coords should be renamed panel_scales or scale"
-[14] "wch : ScalesList-related functions should be moved into ggproto object"
-[15] "wch : update_geom_defaults and update_stat_defaults should accept Geom and Stat objects"
-[16] "wch : Make some ggproto objects immutable. Closes #1237"
-[17] "and3k : Control size of the border and padding of geom_label"
-[18] "hadley : Consistent argument order and formatting for layer functions"
-[19] "hadley : Consistently handle missing values"
-[20] "cmohamma : fortify causes fatal error"
-[21] "lionel- : Flawed `label_bquote()` implementation"
-[22] "beroe : Create alias for `colors=` in `scale_color_gradientn()`"
-[23] "and3k : hjust broken in y facets"
-[24] "joranE : Allow color bar guides for alpha scales"
-[25] "hadley : dir = \"v\" also needs to swap nrow and ncol"
-[26] "joranE : Add examples for removing guides"
-[27] "lionel- : New approach for horizontal layers"
-[28] "bbolker : add horizontal linerange geom"
-[29] "hadley : Write vignette about grid"
-[30] "hadley : Immutable flag for ggproto objects" </code></pre>
+<pre><code> [1] "tdsmith : stat_binhex weight aesthetic is undocumented"
+ [2] "huelf : geom_contour throws error when ggplot aes uses shape"
+ [3] "davidkretch : Fix typo in Extending ggplot2 vignette"
+ [4] "janschulz : data used in geom_text with geom specific aes is longer than it should be?"
+ [5] "janschulz : Add top margin to default plot.caption"
+ [6] "wch : Preserve class when adding uneval objects"
+ [7] "coolbutuseless : corrected theme inhertiance for legend.key.size"
+ [8] "has2k1 : Fix geom_dotplot y limit calculations"
+ [9] "shreyasgm : Typo in error message while saving large plots"
+[10] "DarwinAwardWinner : Ordering of multiple legends is seemingly random"
+[11] "noamross : geom_dotplot extends past axis"
+[12] "aosmith16 : geom_dotplot negates free y scale from facet_wrap"
+[13] "lfaller : How to customize x-axis labels for a stacked bar plot graph?"
+[14] "kfeng123 : How can I axis.ticks while using theme_minimal()?"
+[15] "richardbeare : Design query - connectograms"
+[16] "gcpoole : Plotting SpatialLinesDataFrame connects all of the individual lines"
+[17] "zeehio : [Feature Request] different scales by facet"
+[18] "salauer : geom_smooth parameters no longer available in qplot"
+[19] "luczkovichj : Contour labels using direct.label"
+[20] "coolbutuseless : geom_hex/stat_hex binwidth argument no longer working"
+[21] "HughParsonage : annotate() won't expand when position aesthetics are length 1"
+[22] "whao89 : geom_hex no longer recognizes ..density.. in 2.1.0"
+[23] "paul4forest : X axis doesn't appear below facet_wrap plot with uneven number of facets"
+[24] "DarioS : Allow a Vector of Numbers for label_wrap_gen's Width Parameter"
+[25] "coolbutuseless : stat_bin_2d creates an (almost) unkillable legend."
+[26] "dutri001 : Online documentation: HTML table not properly generated from Latex doc "
+[27] "krlmlr : Conditional examples are not rendered"
+[28] "juliangehring : Facets break grouping of data points"
+[29] "holgerbrandl : segfault on macos when using ggsave in parallelized loop "
+[30] "JestonBlu : Added new economic theme" </code></pre>
</div>
<div id="citibike-nyc" class="section level2">
<h2>CitiBike NYC</h2>
@@ -125,7 +180,7 @@ colnames(stations)</code></pre>
[15] "altitude" "testStation"
[17] "lastCommunicationTime" "landMark" </code></pre>
<pre class="r"><code>nrow(stations)</code></pre>
-<pre><code>[1] 509</code></pre>
+<pre><code>[1] 508</code></pre>
</div>
<div id="ergast" class="section level2">
<h2>Ergast</h2>
@@ -192,20 +247,20 @@ nrow(filings)</code></pre>
</div>
<div id="new-york-times" class="section level2">
<h2>New York Times</h2>
-<p>The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at <a href="http://developer.nytimes.com/docs/reference/keys">here</a>. The code below includes some example keys for illustration purposes.</p>
+<p>The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at <a href="http://developer.nytimes.com/signup">here</a>. The code below includes some example keys for illustration purposes.</p>
<pre class="r"><code>#search for articles
article_key <- "&api-key=c2fede7bd9aea57c898f538e5ec0a1ee:6:68700045"
url <- "http://api.nytimes.com/svc/search/v2/articlesearch.json?q=obamacare+socialism"
req <- fromJSON(paste0(url, article_key))
articles <- req$response$docs
colnames(articles)</code></pre>
-<pre><code> [1] "web_url" "snippet" "lead_paragraph"
- [4] "abstract" "print_page" "blog"
- [7] "source" "multimedia" "headline"
-[10] "keywords" "pub_date" "document_type"
-[13] "news_desk" "section_name" "subsection_name"
-[16] "byline" "type_of_material" "_id"
-[19] "word_count" </code></pre>
+<pre><code> [1] "web_url" "snippet" "lead_paragraph"
+ [4] "abstract" "print_page" "blog"
+ [7] "source" "multimedia" "headline"
+[10] "keywords" "pub_date" "document_type"
+[13] "news_desk" "section_name" "subsection_name"
+[16] "byline" "type_of_material" "_id"
+[19] "word_count" "slideshow_credits"</code></pre>
<pre class="r"><code>#search for best sellers
bestseller_key <- "&api-key=5e260a86a6301f55546c83a47d139b0d:3:68700045"
url <- "http://api.nytimes.com/svc/books/v2/lists/overview.json?published_date=2013-01-01"
@@ -225,19 +280,17 @@ url <- "http://api.nytimes.com/svc/movies/v2/reviews/dvd-picks.json?orde
req <- fromJSON(paste0(url, movie_key))
reviews <- req$results
colnames(reviews)</code></pre>
-<pre><code> [1] "nyt_movie_id" "display_title" "sort_name"
- [4] "mpaa_rating" "critics_pick" "thousand_best"
- [7] "byline" "headline" "capsule_review"
-[10] "summary_short" "publication_date" "opening_date"
-[13] "dvd_release_date" "date_updated" "seo_name"
-[16] "link" "related_urls" "multimedia" </code></pre>
+<pre><code> [1] "display_title" "mpaa_rating" "critics_pick"
+ [4] "byline" "headline" "summary_short"
+ [7] "publication_date" "opening_date" "date_updated"
+[10] "link" "multimedia" </code></pre>
<pre class="r"><code>reviews[1:5, c("display_title", "byline", "mpaa_rating")]</code></pre>
-<pre><code> display_title byline mpaa_rating
-1 Tom at the Farm Stephen Holden NR
-2 A Little Chaos Stephen Holden R
-3 Big Game Andy Webster PG13
-4 Balls Out Andy Webster R
-5 Mad Max: Fury Road A. O. Scott R</code></pre>
+<pre><code> display_title byline mpaa_rating
+1 Dheepan A. O. SCOTT R
+2 Mothers and Daughters NEIL GENZLINGER PG-13
+3 Phantom of the Theater DANIEL M. GOLD
+4 Beautiful Something STEPHEN HOLDEN Not Rated
+5 Elstree 1976 NEIL GENZLINGER </code></pre>
</div>
<div id="crunchbase" class="section level2">
<h2>CrunchBase</h2>
@@ -255,12 +308,18 @@ head(res$results)</code></pre>
drone_bills <- fromJSON(paste0("http://openstates.org/api/v1/bills/?q=drone", key))
drone_bills$title <- substring(drone_bills$title, 1, 40)
print(drone_bills[1:5, c("title", "state", "chamber", "type")])</code></pre>
-<pre><code> title state chamber type
-1 WILDLIFE-TECH il lower bill
-2 Criminalizes the unlawful use of an unma ny lower bill
-3 Criminalizes the unlawful use of an unma ny lower bill
-4 Relating to: criminal procedure and prov wi lower bill
-5 Relating to: criminal procedure and prov wi upper bill</code></pre>
+<pre><code> title state chamber
+1 An act relating to privacy protection vt upper
+2 Crimes: emergency personnel. ca lower
+3 DRONE TASK FORCE APPT il lower
+4 Omnibus K-12 and higher education policy mn lower
+5 Relates to prohibiting civilian drone us ny upper
+ type
+1 bill
+2 bill, fiscal committee, local program
+3 bill
+4 bill
+5 bill</code></pre>
<pre class="r"><code>#Congress mentioning "constitution"
res <- fromJSON(paste0("http://capitolwords.org/api/1/dates.json?phrase=immigration", key))
wordcount <- res$results
@@ -268,11 +327,11 @@ wordcount$day <- as.Date(wordcount$day)
summary(wordcount)</code></pre>
<pre><code> count day raw_count
Min. : 1.00 Min. :1996-01-02 Min. : 1.00
- 1st Qu.: 3.00 1st Qu.:2001-01-22 1st Qu.: 3.00
- Median : 8.00 Median :2005-11-16 Median : 8.00
- Mean : 25.27 Mean :2005-10-02 Mean : 25.27
- 3rd Qu.: 21.00 3rd Qu.:2010-05-12 3rd Qu.: 21.00
- Max. :1835.00 Max. :2015-08-05 Max. :1835.00 </code></pre>
+ 1st Qu.: 3.00 1st Qu.:2001-03-26 1st Qu.: 3.00
+ Median : 8.00 Median :2006-03-21 Median : 8.00
+ Mean : 24.91 Mean :2006-01-30 Mean : 24.91
+ 3rd Qu.: 21.00 3rd Qu.:2010-12-08 3rd Qu.: 21.00
+ Max. :1835.00 Max. :2016-04-27 Max. :1835.00 </code></pre>
<pre class="r"><code>#Local legislators
legislators <- fromJSON(paste0("http://congress.api.sunlightfoundation.com/",
"legislators/locate?latitude=42.96&longitude=-108.09", key))
@@ -290,10 +349,9 @@ consumer_key = "EZRy5JzOH2QQmVAe9B4j2w";
consumer_secret = "OIDC4MdfZJ82nbwpZfoUO4WOLTYjoRhpHRAWj6JMec";
#Use basic auth
-library(httr)
-secret <- RCurl::base64(paste(consumer_key, consumer_secret, sep = ":"));
-req <- POST("https://api.twitter.com/oauth2/token",
- add_headers(
+secret <- openssl::base64_encode(paste(consumer_key, consumer_secret, sep = ":"));
+req <- httr::POST("https://api.twitter.com/oauth2/token",
+ httr::add_headers(
"Authorization" = paste("Basic", secret),
"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8"
),
@@ -305,23 +363,25 @@ token <- paste("Bearer", content(req)$access_token)
#Actual API call
url <- "https://api.twitter.com/1.1/statuses/user_timeline.json?count=10&screen_name=Rbloggers"
-req <- GET(url, add_headers(Authorization = token))
-json <- content(req, as = "text")
+req <- httr::GET(url, add_headers(Authorization = token))
+json <- httr::content(req, as = "text")
tweets <- fromJSON(json)
substring(tweets$text, 1, 100)</code></pre>
-<pre><code> [1] "Analysing longitudinal data: Multilevel growth models (II) http://t.co/unUxszG7VJ #rstats"
- [2] "RcppDE 0.1.4 http://t.co/3qPhFzoOpj #rstats"
- [3] "Minimalist Maps http://t.co/fpkNznuCoX #rstats"
- [4] "Tutorials freely available of course I taught: including ggplot2, dplyr and shiny http://t.co/WsxX4U"
- [5] "Deploying Shiny apps with shinyapps.io http://t.co/tjef1pbKLt #rstats"
- [6] "Bootstrap Evaluation of Clusters http://t.co/EbY7ziKCz5 #rstats"
- [7] "Add external code to Rmarkdown http://t.co/RCJEmS8gyP #rstats"
- [8] "Linear models with weighted observations http://t.co/pUoHpvxAGC #rstats"
- [9] "dplyr 0.4.3 http://t.co/ze3zc8t7qj #rstats"
-[10] "xkcd survey and the power to shape the internet http://t.co/vNaKhxWxE4 #rstats" </code></pre>
+<pre><code> [1] "Rblpapi 0.3.4 https://t.co/NoGluTGSld #rstats #DataScience"
+ [2] "Introducing DohaR – A new R User Group in Doha, Qatar https://t.co/MWSKgMap9I #rstats #DataScience"
+ [3] "FSA v0.8.7 Released https://t.co/2nnGMGINA7 #rstats #DataScience"
+ [4] "Too Much Parallelism is as Bad https://t.co/t0RffUvLYs #rstats #DataScience"
+ [5] "Coming up: principal components analysis https://t.co/f9dUnhuC9n #rstats #DataScience"
+ [6] "Shiny Apps Gallery using Plotly in R https://t.co/cEFvgy1VPY #rstats #DataScience"
+ [7] "Who is going down? Bundesliga Betting Odds – updated https://t.co/uvpcmOmcaf #rstats #DataScience"
+ [8] "BH 1.60.0-2 https://t.co/kZHVjPzG65 #rstats #DataScience"
+ [9] "Red herring bites https://t.co/IJQwBQkImx #rstats #DataScience"
+[10] "R Tools for Visual Studio 3.0 now available https://t.co/JWKthTwEnC #rstats #DataScience" </code></pre>
</div>
+
+
</div>
<script>
diff --git a/inst/doc/json-mapping.pdf b/inst/doc/json-mapping.pdf
index 36ab89e..f95c0b3 100644
Binary files a/inst/doc/json-mapping.pdf and b/inst/doc/json-mapping.pdf differ
diff --git a/inst/doc/json-opencpu.pdf b/inst/doc/json-opencpu.pdf
index 2af2954..3f79a70 100644
Binary files a/inst/doc/json-opencpu.pdf and b/inst/doc/json-opencpu.pdf differ
diff --git a/inst/doc/json-paging.Rmd b/inst/doc/json-paging.Rmd
index 14860b2..7a7f965 100644
--- a/inst/doc/json-paging.Rmd
+++ b/inst/doc/json-paging.Rmd
@@ -1,6 +1,6 @@
---
title: "Combining pages of JSON data with jsonlite"
-date: "2015-09-06"
+date: "2016-05-09"
output:
html_document
vignette: >
diff --git a/inst/doc/json-paging.html b/inst/doc/json-paging.html
index 0155e61..36ffd24 100644
--- a/inst/doc/json-paging.html
+++ b/inst/doc/json-paging.html
@@ -9,20 +9,21 @@
<meta name="generator" content="pandoc" />
-<meta name="date" content="2015-09-06" />
+
+<meta name="date" content="2016-05-09" />
<title>Combining pages of JSON data with jsonlite</title>
-<script src="data:application/x-javascript,%2F%2A%21%20jQuery%20v1%2E11%2E0%20%7C%20%28c%29%202005%2C%202014%20jQuery%20Foundation%2C%20Inc%2E%20%7C%20jquery%2Eorg%2Flicense%20%2A%2F%0A%21function%28a%2Cb%29%7B%22object%22%3D%3Dtypeof%20module%26%26%22object%22%3D%3Dtypeof%20module%2Eexports%3Fmodule%2Eexports%3Da%2Edocument%3Fb%28a%2C%210%29%3Afunction%28a%29%7Bif%28%21a%2Edocument%29throw%20new%20Error%28%22jQuery%20requires%20a%20window%20with%20a%20document%22%29%3Breturn%20b%28a%29% [...]
+<script src="data:application/x-javascript;base64,LyohIGpRdWVyeSB2MS4xMS4zIHwgKGMpIDIwMDUsIDIwMTUgalF1ZXJ5IEZvdW5kYXRpb24sIEluYy4gfCBqcXVlcnkub3JnL2xpY2Vuc2UgKi8KIWZ1bmN0aW9uKGEsYil7Im9iamVjdCI9PXR5cGVvZiBtb2R1bGUmJiJvYmplY3QiPT10eXBlb2YgbW9kdWxlLmV4cG9ydHM/bW9kdWxlLmV4cG9ydHM9YS5kb2N1bWVudD9iKGEsITApOmZ1bmN0aW9uKGEpe2lmKCFhLmRvY3VtZW50KXRocm93IG5ldyBFcnJvcigialF1ZXJ5IHJlcXVpcmVzIGEgd2luZG93IHdpdGggYSBkb2N1bWVudCIpO3JldHVybiBiKGEpfTpiKGEpfSgidW5kZWZpbmVkIiE9dHlwZW9mIHdpbmRvdz93aW5kb3c6dG [...]
<meta name="viewport" content="width=device-width, initial-scale=1" />
-<link href="data:text/css,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%2F%2A%21%20normalize%2Ecss%20v3%2E0%2E2%20%7C%20MIT%20License%20%7C%20git%2Eio%2Fnormalize%20%2A%2Fhtml%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsiz [...]
-<script src="data:application/x-javascript,%2F%2A%21%0A%20%2A%20Bootstrap%20v3%2E3%2E1%20%28http%3A%2F%2Fgetbootstrap%2Ecom%29%0A%20%2A%20Copyright%202011%2D2014%20Twitter%2C%20Inc%2E%0A%20%2A%20Licensed%20under%20MIT%20%28https%3A%2F%2Fgithub%2Ecom%2Ftwbs%2Fbootstrap%2Fblob%2Fmaster%2FLICENSE%29%0A%20%2A%2F%0Aif%28%22undefined%22%3D%3Dtypeof%20jQuery%29throw%20new%20Error%28%22Bootstrap%27s%20JavaScript%20requires%20jQuery%22%29%3B%2Bfunction%28a%29%7Bvar%20b%3Da%2Efn%2Ejquery%2Esplit%2 [...]
-<script src="data:application/x-javascript,%2F%2A%2A%0A%2A%20%40preserve%20HTML5%20Shiv%203%2E7%2E2%20%7C%20%40afarkas%20%40jdalton%20%40jon%5Fneal%20%40rem%20%7C%20MIT%2FGPL2%20Licensed%0A%2A%2F%0A%2F%2F%20Only%20run%20this%20code%20in%20IE%208%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%2Cb%29%7Bfunction%20c%28a%2Cb%29%7Bvar%20c%3Da%2EcreateElement%28%22p%22%29%2Cd%3Da%2EgetElementsByTagName%28%22head%22%29%5B0%5D%7C%7Ca%2Edocum [...]
-<script src="data:application/x-javascript,%2F%2A%21%20Respond%2Ejs%20v1%2E4%2E2%3A%20min%2Fmax%2Dwidth%20media%20query%20polyfill%20%2A%20Copyright%202013%20Scott%20Jehl%0A%20%2A%20Licensed%20under%20https%3A%2F%2Fgithub%2Ecom%2Fscottjehl%2FRespond%2Fblob%2Fmaster%2FLICENSE%2DMIT%0A%20%2A%20%20%2A%2F%0A%0Aif%20%28%21%21window%2Enavigator%2EuserAgent%2Ematch%28%22MSIE%208%22%29%29%20%7B%0A%21function%28a%29%7B%22use%20strict%22%3Ba%2EmatchMedia%3Da%2EmatchMedia%7C%7Cfunction%28a%29%7Bvar [...]
+<link href="data:text/css;charset=utf-8,html%7Bfont%2Dfamily%3Asans%2Dserif%3B%2Dwebkit%2Dtext%2Dsize%2Dadjust%3A100%25%3B%2Dms%2Dtext%2Dsize%2Dadjust%3A100%25%7Dbody%7Bmargin%3A0%7Darticle%2Caside%2Cdetails%2Cfigcaption%2Cfigure%2Cfooter%2Cheader%2Chgroup%2Cmain%2Cmenu%2Cnav%2Csection%2Csummary%7Bdisplay%3Ablock%7Daudio%2Ccanvas%2Cprogress%2Cvideo%7Bdisplay%3Ainline%2Dblock%3Bvertical%2Dalign%3Abaseline%7Daudio%3Anot%28%5Bcontrols%5D%29%7Bdisplay%3Anone%3Bheight%3A0%7D%5Bhidden%5D%2Ctem [...]
+<script src="data:application/x-javascript;base64,LyohCiAqIEJvb3RzdHJhcCB2My4zLjUgKGh0dHA6Ly9nZXRib290c3RyYXAuY29tKQogKiBDb3B5cmlnaHQgMjAxMS0yMDE1IFR3aXR0ZXIsIEluYy4KICogTGljZW5zZWQgdW5kZXIgdGhlIE1JVCBsaWNlbnNlCiAqLwppZigidW5kZWZpbmVkIj09dHlwZW9mIGpRdWVyeSl0aHJvdyBuZXcgRXJyb3IoIkJvb3RzdHJhcCdzIEphdmFTY3JpcHQgcmVxdWlyZXMgalF1ZXJ5Iik7K2Z1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0Ijt2YXIgYj1hLmZuLmpxdWVyeS5zcGxpdCgiICIpWzBdLnNwbGl0KCIuIik7aWYoYlswXTwyJiZiWzFdPDl8fDE9PWJbMF0mJjk9PWJbMV0mJmJbMl08MSl0aHJvdy [...]
+<script src="data:application/x-javascript;base64,LyoqCiogQHByZXNlcnZlIEhUTUw1IFNoaXYgMy43LjIgfCBAYWZhcmthcyBAamRhbHRvbiBAam9uX25lYWwgQHJlbSB8IE1JVC9HUEwyIExpY2Vuc2VkCiovCi8vIE9ubHkgcnVuIHRoaXMgY29kZSBpbiBJRSA4CmlmICghIXdpbmRvdy5uYXZpZ2F0b3IudXNlckFnZW50Lm1hdGNoKCJNU0lFIDgiKSkgewohZnVuY3Rpb24oYSxiKXtmdW5jdGlvbiBjKGEsYil7dmFyIGM9YS5jcmVhdGVFbGVtZW50KCJwIiksZD1hLmdldEVsZW1lbnRzQnlUYWdOYW1lKCJoZWFkIilbMF18fGEuZG9jdW1lbnRFbGVtZW50O3JldHVybiBjLmlubmVySFRNTD0ieDxzdHlsZT4iK2IrIjwvc3R5bGU+IixkLm [...]
+<script src="data:application/x-javascript;base64,LyohIFJlc3BvbmQuanMgdjEuNC4yOiBtaW4vbWF4LXdpZHRoIG1lZGlhIHF1ZXJ5IHBvbHlmaWxsICogQ29weXJpZ2h0IDIwMTMgU2NvdHQgSmVobAogKiBMaWNlbnNlZCB1bmRlciBodHRwczovL2dpdGh1Yi5jb20vc2NvdHRqZWhsL1Jlc3BvbmQvYmxvYi9tYXN0ZXIvTElDRU5TRS1NSVQKICogICovCgovLyBPbmx5IHJ1biB0aGlzIGNvZGUgaW4gSUUgOAppZiAoISF3aW5kb3cubmF2aWdhdG9yLnVzZXJBZ2VudC5tYXRjaCgiTVNJRSA4IikpIHsKIWZ1bmN0aW9uKGEpeyJ1c2Ugc3RyaWN0IjthLm1hdGNoTWVkaWE9YS5tYXRjaE1lZGlhfHxmdW5jdGlvbihhKXt2YXIgYixjPWEuZG [...]
<style type="text/css">code{white-space: pre;}</style>
-<link href="data:text/css,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0A%20color%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0A%0Apre%20%2Eliteral%20%7B%0A%20color%3A%20%23990073%0A%7D%0A%0Apre%20%2Enumber%20%7B%0A%20color%3A%20%23099%3B%0A%7D%0A%0Apre%20%2Ecomment%20%7B%0A%20color%3A%20%23998%3B%0A%20font%2Dstyle%3A%20italic%0A%7D%0A%0Apre%20%2Ekeyword%20%7B%0A%20color%3A%20%23900%3B%0A%20font%2Dweight%3A%20bold%0A%7D%0A%0Apre%20%2Eidentifier%20%7B%0A%20color%3A%20rgb%280%2C%200%2C%200%29 [...]
-<script src="data:application/x-javascript,%0Avar%20hljs%3Dnew%20function%28%29%7Bfunction%20m%28p%29%7Breturn%20p%2Ereplace%28%2F%26%2Fgm%2C%22%26amp%3B%22%29%2Ereplace%28%2F%3C%2Fgm%2C%22%26lt%3B%22%29%7Dfunction%20f%28r%2Cq%2Cp%29%7Breturn%20RegExp%28q%2C%22m%22%2B%28r%2EcI%3F%22i%22%3A%22%22%29%2B%28p%3F%22g%22%3A%22%22%29%29%7Dfunction%20b%28r%29%7Bfor%28var%20p%3D0%3Bp%3Cr%2EchildNodes%2Elength%3Bp%2B%2B%29%7Bvar%20q%3Dr%2EchildNodes%5Bp%5D%3Bif%28q%2EnodeName%3D%3D%22CODE%22%29%7B [...]
+<link href="data:text/css;charset=utf-8,pre%20%2Eoperator%2C%0Apre%20%2Eparen%20%7B%0Acolor%3A%20rgb%28104%2C%20118%2C%20135%29%0A%7D%0Apre%20%2Eliteral%20%7B%0Acolor%3A%20%23990073%0A%7D%0Apre%20%2Enumber%20%7B%0Acolor%3A%20%23099%3B%0A%7D%0Apre%20%2Ecomment%20%7B%0Acolor%3A%20%23998%3B%0Afont%2Dstyle%3A%20italic%0A%7D%0Apre%20%2Ekeyword%20%7B%0Acolor%3A%20%23900%3B%0Afont%2Dweight%3A%20bold%0A%7D%0Apre%20%2Eidentifier%20%7B%0Acolor%3A%20rgb%280%2C%200%2C%200%29%3B%0A%7D%0Apre%20%2Estri [...]
+<script src="data:application/x-javascript;base64,CnZhciBobGpzPW5ldyBmdW5jdGlvbigpe2Z1bmN0aW9uIG0ocCl7cmV0dXJuIHAucmVwbGFjZSgvJi9nbSwiJmFtcDsiKS5yZXBsYWNlKC88L2dtLCImbHQ7Iil9ZnVuY3Rpb24gZihyLHEscCl7cmV0dXJuIFJlZ0V4cChxLCJtIisoci5jST8iaSI6IiIpKyhwPyJnIjoiIikpfWZ1bmN0aW9uIGIocil7Zm9yKHZhciBwPTA7cDxyLmNoaWxkTm9kZXMubGVuZ3RoO3ArKyl7dmFyIHE9ci5jaGlsZE5vZGVzW3BdO2lmKHEubm9kZU5hbWU9PSJDT0RFIil7cmV0dXJuIHF9aWYoIShxLm5vZGVUeXBlPT0zJiZxLm5vZGVWYWx1ZS5tYXRjaCgvXHMrLykpKXticmVha319fWZ1bmN0aW9uIGgodC [...]
<style type="text/css">
pre:not([class]) {
background-color: white;
@@ -38,6 +39,34 @@ if (window.hljs && document.readyState && document.readyState === "complete") {
+<style type="text/css">
+h1 {
+ font-size: 34px;
+}
+h1.title {
+ font-size: 38px;
+}
+h2 {
+ font-size: 30px;
+}
+h3 {
+ font-size: 24px;
+}
+h4 {
+ font-size: 18px;
+}
+h5 {
+ font-size: 16px;
+}
+h6 {
+ font-size: 12px;
+}
+.table th:not([align]) {
+ text-align: left;
+}
+</style>
+
+
</head>
<body>
@@ -52,17 +81,43 @@ code {
color: inherit;
background-color: rgba(0, 0, 0, 0.04);
}
-img {
- max-width:100%;
- height: auto;
+img {
+ max-width:100%;
+ height: auto;
+}
+.tabbed-pane {
+ padding-top: 12px;
+}
+button.code-folding-btn:focus {
+ outline: none;
}
</style>
+
+
<div class="container-fluid main-container">
+<!-- tabsets -->
+<script src="data:application/x-javascript;base64,Cgp3aW5kb3cuYnVpbGRUYWJzZXRzID0gZnVuY3Rpb24odG9jSUQpIHsKCiAgLy8gYnVpbGQgYSB0YWJzZXQgZnJvbSBhIHNlY3Rpb24gZGl2IHdpdGggdGhlIC50YWJzZXQgY2xhc3MKICBmdW5jdGlvbiBidWlsZFRhYnNldCh0YWJzZXQpIHsKCiAgICAvLyBjaGVjayBmb3IgZmFkZSBhbmQgcGlsbHMgb3B0aW9ucwogICAgdmFyIGZhZGUgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1mYWRlIik7CiAgICB2YXIgcGlsbHMgPSB0YWJzZXQuaGFzQ2xhc3MoInRhYnNldC1waWxscyIpOwogICAgdmFyIG5hdkNsYXNzID0gcGlsbHMgPyAibmF2LXBpbGxzIiA6ICJuYXYtdGFicyI7CgogIC [...]
+<script>
+$(document).ready(function () {
+ window.buildTabsets("TOC");
+});
+</script>
+
+<!-- code folding -->
+
+
+
+
+
+
+<div class="fluid-row" id="header">
+
+
+
+<h1 class="title toc-ignore">Combining pages of JSON data with jsonlite</h1>
+<h4 class="date"><em>2016-05-09</em></h4>
-<div id="header">
-<h1 class="title">Combining pages of JSON data with jsonlite</h1>
-<h4 class="date"><em>2015-09-06</em></h4>
</div>
@@ -235,6 +290,8 @@ nrow(filings)</code></pre>
</div>
+
+
</div>
<script>
diff --git a/man/base64.Rd b/man/base64.Rd
new file mode 100644
index 0000000..10778ba
--- /dev/null
+++ b/man/base64.Rd
@@ -0,0 +1,26 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/base64.R
+\name{base64}
+\alias{base64}
+\alias{base64_dec}
+\alias{base64_enc}
+\title{Encode/decode base64}
+\usage{
+base64_dec(input)
+
+base64_enc(input)
+}
+\arguments{
+\item{input}{string or raw vector to be encoded/decoded}
+}
+\description{
+Simple in-memory base64 encoder and decoder. Used internally for converting
+raw vectors to text. Interchangable with encoder from \code{base64enc} or
+\code{openssl} package.
+}
+\examples{
+str <- base64_enc(serialize(iris, NULL))
+out <- unserialize(base64_dec(str))
+stopifnot(identical(out, iris))
+}
+
diff --git a/man/flatten.Rd b/man/flatten.Rd
index b98b548..8591863 100644
--- a/man/flatten.Rd
+++ b/man/flatten.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flatten.R
\name{flatten}
\alias{flatten}
@@ -35,5 +35,6 @@ colnames(flatten(data1))
data2 <- fromJSON("https://api.github.com/users/hadley/repos", flatten = TRUE)
colnames(data2)
}
+
}
diff --git a/man/fromJSON.Rd b/man/fromJSON.Rd
index 6da565a..75b12c1 100644
--- a/man/fromJSON.Rd
+++ b/man/fromJSON.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fromJSON.R, R/toJSON.R
\name{toJSON, fromJSON}
\alias{fromJSON}
@@ -53,7 +53,7 @@ toJSON(x, dataframe = c("rows", "columns", "values"), matrix = c("rowmajor",
\item{auto_unbox}{automatically \code{\link{unbox}} all atomic vectors of length 1. It is usually safer to avoid this and instead use the \code{\link{unbox}} function to unbox individual elements.
An exception is that objects of class \code{AsIs} (i.e. wrapped in \code{I()}) are not automatically unboxed. This is a way to mark single values as length-1 arrays.}
-\item{digits}{max number of decimal digits to print for numeric values. Use \code{I()} to specify significant digits.}
+\item{digits}{max number of decimal digits to print for numeric values. Use \code{I()} to specify significant digits. Use \code{NA} for max precision.}
\item{pretty}{adds indentation whitespace to JSON output. Can be TRUE/FALSE or a number specifying the number of spaces to indent. See \code{\link{prettify}}}
diff --git a/man/prettify.Rd b/man/prettify.Rd
index 09d8ad7..b208116 100644
--- a/man/prettify.Rd
+++ b/man/prettify.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prettify.R
\name{prettify, minify}
\alias{minify}
diff --git a/man/rbind.pages.Rd b/man/rbind.pages.Rd
index c676901..7956ead 100644
--- a/man/rbind.pages.Rd
+++ b/man/rbind.pages.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rbind.pages.R
\name{rbind.pages}
\alias{rbind.pages}
diff --git a/man/serializeJSON.Rd b/man/serializeJSON.Rd
index f8c5278..73924b4 100644
--- a/man/serializeJSON.Rd
+++ b/man/serializeJSON.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/serializeJSON.R
\name{serializeJSON}
\alias{serializeJSON}
diff --git a/man/stream_in.Rd b/man/stream_in.Rd
index 5070ade..c9af9f7 100644
--- a/man/stream_in.Rd
+++ b/man/stream_in.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/stream.R
\name{stream_in, stream_out}
\alias{stream_in}
diff --git a/man/unbox.Rd b/man/unbox.Rd
index 32a08a4..b991ad5 100644
--- a/man/unbox.Rd
+++ b/man/unbox.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/unbox.R
\name{unbox}
\alias{unbox}
diff --git a/man/validate.Rd b/man/validate.Rd
index 0c2806e..572869b 100644
--- a/man/validate.Rd
+++ b/man/validate.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/validate.R
\name{validate}
\alias{validate}
diff --git a/src/Makevars b/src/Makevars
index 8758ee1..bf356df 100644
--- a/src/Makevars
+++ b/src/Makevars
@@ -1,19 +1,15 @@
-PKG_CPPFLAGS = -Iyajl -Iyajl/api -I.
+PKG_CPPFLAGS = -Iyajl/api
+PKG_LIBS = -L. -lstatyajl
-SOURCES = yajl/yajl.c yajl/yajl_alloc.c yajl/yajl_buf.c yajl/yajl_encode.c \
- yajl/yajl_gen.c yajl/yajl_lex.c yajl/yajl_parser.c yajl/yajl_tree.c \
- yajl/yajl_version.c base64.c collapse_array.c collapse_object.c \
- escape_chars.c is_recordlist.c is_scalarlist.c null_to_na.c parse.c \
- prettify.c validate.c modp_numtoa.c num_to_char.c integer64_to_na.c \
- push_parser.c collapse_pretty.c row_collapse.c
+LIBYAJL = yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o \
+ yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
-# For development only (GNU/GCC specific not allowed on CRAN):
-# SOURCES = $(wildcard yajl/*.c *.c)
-# PKG_CFLAGS= -Wall -pedantic
+#all: clean
-OBJECTS = $(SOURCES:.c=.o)
+$(SHLIB): libstatyajl.a
-all: clean $(OBJECTS)
+libstatyajl.a: $(LIBYAJL)
+ $(AR) rcs libstatyajl.a $(LIBYAJL)
clean:
- rm -f $(OBJECTS)
+ rm -f $(LIBYAJL) $(SHLIB) $(OBJECTS) libstatyajl.a
diff --git a/src/base64.c b/src/base64.c
index 24369bc..8cb6c67 100644
--- a/src/base64.c
+++ b/src/base64.c
@@ -1,225 +1,142 @@
-
-#include "base64.h"
-
/*
-** Translation Table as described in RFC1113
-*/
-static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ * Based off: http://src.gnu-darwin.org/src/contrib/wpa_supplicant/base64.c
+ * BSD Licensed.
+ */
-/*
-** Translation Table to decode (created by author)
-*/
-static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
+#include <stdlib.h>
+#include <string.h>
-/*
-** encodeblock
-**
-** encode 3 8-bit binary bytes as 4 '6-bit' characters
-*/
-void encodeblock( unsigned char in[3], unsigned char out[4], int len )
-{
- out[0] = cb64[ in[0] >> 2 ];
- out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ];
- out[2] = (unsigned char) (len > 1 ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '=');
- out[3] = (unsigned char) (len > 2 ? cb64[ in[2] & 0x3f ] : '=');
-}
+#include "base64.h"
-/*
-** encode
-**
-** base64 encode a stream adding padding and line breaks as per spec.
-*/
-void encode( FILE *infile, FILE *outfile, int linesize )
+static const unsigned char base64_table[64] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+/**
+ * base64_encode - Base64 encode
+ * @src: Data to be encoded
+ * @len: Length of the data to be encoded
+ * @out_len: Pointer to output length variable, or %NULL if not used
+ * Returns: Allocated buffer of out_len bytes of encoded data,
+ * or %NULL on failure
+ *
+ * Caller is responsible for freeing the returned buffer. Returned buffer is
+ * nul terminated to make it easier to use as a C string. The nul terminator is
+ * not included in out_len.
+ */
+unsigned char * base64_encode(const unsigned char *src, size_t len,
+ size_t *out_len)
{
- unsigned char in[3], out[4];
- int i, len, blocksout = 0;
-
- while( !feof( infile ) ) {
- len = 0;
- for( i = 0; i < 3; i++ ) {
- in[i] = (unsigned char) getc( infile );
- if( !feof( infile ) ) {
- len++;
- }
- else {
- in[i] = 0;
- }
- }
- if( len ) {
- encodeblock( in, out, len );
- for( i = 0; i < 4; i++ ) {
- putc( out[i], outfile );
- }
- blocksout++;
- }
- if( blocksout >= (linesize/4) || feof( infile ) ) {
- if( blocksout ) {
- fprintf( outfile, "\r\n" );
- }
- blocksout = 0;
- }
- }
-}
-
-/*
-** decodeblock
-**
-** decode 4 '6-bit' characters into 3 8-bit binary bytes
-*/
-void decodeblock( unsigned char in[4], unsigned char out[3] )
-{
- out[ 0 ] = (unsigned char ) (in[0] << 2 | in[1] >> 4);
- out[ 1 ] = (unsigned char ) (in[1] << 4 | in[2] >> 2);
- out[ 2 ] = (unsigned char ) (((in[2] << 6) & 0xc0) | in[3]);
-}
+ unsigned char *out, *pos;
+ const unsigned char *end, *in;
+ size_t olen;
+ int line_len;
+
+ olen = len * 4 / 3 + 4; /* 3-byte blocks to 4-byte */
+ olen += olen / 72; /* line feeds */
+ olen++; /* nul termination */
+ out = malloc(olen);
+ if (out == NULL)
+ return NULL;
+
+ end = src + len;
+ in = src;
+ pos = out;
+ line_len = 0;
+ while (end - in >= 3) {
+ *pos++ = base64_table[in[0] >> 2];
+ *pos++ = base64_table[((in[0] & 0x03) << 4) | (in[1] >> 4)];
+ *pos++ = base64_table[((in[1] & 0x0f) << 2) | (in[2] >> 6)];
+ *pos++ = base64_table[in[2] & 0x3f];
+ in += 3;
+ line_len += 4;
+ if (line_len >= 72) {
+ *pos++ = '\n';
+ line_len = 0;
+ }
+ }
-/*
-** decode
-**
-** decode a base64 encoded stream discarding padding, line breaks and noise
-*/
-void decode( FILE *infile, FILE *outfile )
-{
- unsigned char in[4], out[3], v;
- int i, len;
-
- while( !feof( infile ) ) {
- for( len = 0, i = 0; i < 4 && !feof( infile ); i++ ) {
- v = 0;
- while( !feof( infile ) && v == 0 ) {
- v = (unsigned char) getc( infile );
- v = (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]);
- if( v ) {
- v = (unsigned char) ((v == '$') ? 0 : v - 61);
- }
- }
- if( !feof( infile ) ) {
- len++;
- if( v ) {
- in[ i ] = (unsigned char) (v - 1);
- }
- }
- else {
- in[i] = 0;
- }
- }
- if( len ) {
- decodeblock( in, out );
- for( i = 0; i < len - 1; i++ ) {
- putc( out[i], outfile );
- }
- }
- }
-}
+ if (end - in) {
+ *pos++ = base64_table[in[0] >> 2];
+ if (end - in == 1) {
+ *pos++ = base64_table[(in[0] & 0x03) << 4];
+ *pos++ = '=';
+ } else {
+ *pos++ = base64_table[((in[0] & 0x03) << 4) |
+ (in[1] >> 4)];
+ *pos++ = base64_table[(in[1] & 0x0f) << 2];
+ }
+ *pos++ = '=';
+ line_len += 4;
+ }
+ //if (line_len)
+ // *pos++ = '\n';
-/*
-** b64_message
-**
-** Gather text messages in one place.
-**
-*/
-char *b64_message( int errcode )
-{
- char *msgs[ B64_MAX_MESSAGES ] = {
- "b64:000:Invalid Message Code.",
- "b64:001:Syntax Error -- check help for usage.",
- "b64:002:File Error Opening/Creating Files.",
- "b64:003:File I/O Error -- Note: output file not removed.",
- "b64:004:Error on output file close.",
- "b64:004:linesize set to minimum."
- };
- char *msg = msgs[ 0 ];
-
- if( errcode > 0 && errcode < B64_MAX_MESSAGES ) {
- msg = msgs[ errcode ];
- }
-
- return( msg );
+ *pos = '\0';
+ if (out_len)
+ *out_len = pos - out;
+ return out;
}
-/*
-** b64
-**
-** 'engine' that opens streams and calls encode/decode
-*/
-int b64( int opt, char *infilename, char *outfilename, int linesize )
+/**
+ * base64_decode - Base64 decode
+ * @src: Data to be decoded
+ * @len: Length of the data to be decoded
+ * @out_len: Pointer to output length variable
+ * Returns: Allocated buffer of out_len bytes of decoded data,
+ * or %NULL on failure
+ *
+ * Caller is responsible for freeing the returned buffer.
+ */
+unsigned char * base64_decode(const unsigned char *src, size_t len,
+ size_t *out_len)
{
- FILE *infile;
- int retcode = B64_FILE_ERROR;
-
- if( !infilename ) {
- infile = stdin;
- }
- else {
- infile = fopen( infilename, "rb" );
- }
- if( !infile ) {
- perror( infilename );
- }
- else {
- FILE *outfile;
- // if( !outfilename ) {
- // outfile = stdout;
- // }
- // else {
- outfile = fopen( outfilename, "wb" );
- // }
- if( !outfile ) {
- perror( outfilename );
- }
- else {
- if( opt == 'e' ) {
- encode( infile, outfile, linesize );
- }
- else {
- decode( infile, outfile );
- }
- if (ferror( infile ) || ferror( outfile )) {
- retcode = B64_FILE_IO_ERROR;
- }
- else {
- retcode = 0;
- }
- // if( outfile != stdout ) {
- if( fclose( outfile ) != 0 ) {
- perror( b64_message( B64_ERROR_OUT_CLOSE ) );
- retcode = B64_FILE_IO_ERROR;
- }
- // }
- }
- if( infile != stdin ) {
- fclose( infile );
- }
- }
-
- return( retcode );
-}
-
-
-/* R functions */
-
-SEXP base64_encode_(SEXP input, SEXP output, SEXP line_size){
- int res = b64( 'e',
- (char*)CHAR(STRING_ELT(input,0)),
- (char*)CHAR(STRING_ELT(output,0)),
- INTEGER(line_size)[0] ) ;
- if( res ){
- error( "%s\n", b64_message( res ) ) ;
+ unsigned char dtable[256], *out, *pos, in[4], block[4], tmp;
+ size_t i, count;
+
+ memset(dtable, 0x80, 256);
+ for (i = 0; i < sizeof(base64_table); i++)
+ dtable[base64_table[i]] = i;
+ dtable['='] = 0;
+
+ count = 0;
+ for (i = 0; i < len; i++) {
+ if (dtable[src[i]] != 0x80)
+ count++;
}
- return R_NilValue ;
-}
-SEXP base64_decode_(SEXP input, SEXP output){
- int res = b64( 'd',
- (char*)CHAR(STRING_ELT(input,0)),
- (char*)CHAR(STRING_ELT(output,0)),
- 0 ) ;
- if( res ){
- error( "%s\n", b64_message( res ) ) ;
+ if (count % 4)
+ return NULL;
+
+ pos = out = malloc(count);
+ if (out == NULL)
+ return NULL;
+
+ count = 0;
+ for (i = 0; i < len; i++) {
+ tmp = dtable[src[i]];
+ if (tmp == 0x80)
+ continue;
+
+ in[count] = src[i];
+ block[count] = tmp;
+ count++;
+ if (count == 4) {
+ *pos++ = (block[0] << 2) | (block[1] >> 4);
+ *pos++ = (block[1] << 4) | (block[2] >> 2);
+ *pos++ = (block[2] << 6) | block[3];
+ count = 0;
+ }
}
- return R_NilValue ;
-}
+ if (pos > out) {
+ if (in[2] == '=')
+ pos -= 2;
+ else if (in[3] == '=')
+ pos--;
+ }
+ *out_len = pos - out;
+ return out;
+}
diff --git a/src/base64.h b/src/base64.h
index 5281f58..d4998d0 100644
--- a/src/base64.h
+++ b/src/base64.h
@@ -1,33 +1,23 @@
-#ifndef BASE64__BASE64_H
-#define BASE64__BASE64_H
-
-#include <R.h>
-#include <Rinternals.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
/*
-** returnable errors
-**
-** Error codes returned to the operating system.
-**
-*/
-#define B64_SYNTAX_ERROR 1
-#define B64_FILE_ERROR 2
-#define B64_FILE_IO_ERROR 3
-#define B64_ERROR_OUT_CLOSE 4
-#define B64_LINE_SIZE_TO_MIN 5
-
-#define B64_DEF_LINE_SIZE 72
-#define B64_MIN_LINE_SIZE 4
-
-#define THIS_OPT(ac, av) (ac > 1 ? av[1][0] == '-' ? av[1][1] : 0 : 0)
-
-#define B64_MAX_MESSAGES 6
-
-SEXP base64_encode_(SEXP input, SEXP output, SEXP line_size) ;
-SEXP base64_decode_(SEXP input, SEXP output) ;
-
-
-#endif
+ * Base64 encoding/decoding (RFC1341)
+ * Copyright (c) 2005, Jouni Malinen <jkmaline at cc.hut.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef BASE64_H
+#define BASE64_H
+
+unsigned char * base64_encode(const unsigned char *src, size_t len,
+ size_t *out_len);
+unsigned char * base64_decode(const unsigned char *src, size_t len,
+ size_t *out_len);
+
+#endif /* BASE64_H */
diff --git a/src/integer64_to_na.c b/src/integer64_to_na.c
index 850d62d..8071e4b 100644
--- a/src/integer64_to_na.c
+++ b/src/integer64_to_na.c
@@ -1,5 +1,5 @@
#include <Rinternals.h>
-#include <modp_numtoa.h>
+#include "modp_numtoa.h"
#define NA_INTEGER64 LLONG_MIN
SEXP R_integer64_to_char(SEXP x, SEXP na_as_string){
diff --git a/src/num_to_char.c b/src/num_to_char.c
index 8aa9b44..ede4de6 100644
--- a/src/num_to_char.c
+++ b/src/num_to_char.c
@@ -1,12 +1,13 @@
#include <Rdefines.h>
#include <Rinternals.h>
#include <stdlib.h>
-#include <modp_numtoa.h>
+#include "modp_numtoa.h"
-SEXP R_num_to_char(SEXP x, SEXP digits, SEXP na_as_string, SEXP use_signif) {
+SEXP R_num_to_char(SEXP x, SEXP digits, SEXP na_as_string, SEXP use_signif, SEXP always_decimal) {
int len = length(x);
int na_string = asLogical(na_as_string);
int signif = asLogical(use_signif);
+ int always_dec = asLogical(always_decimal);
char buf[32];
SEXP out = PROTECT(allocVector(STRSXP, len));
if(isInteger(x)){
@@ -26,6 +27,7 @@ SEXP R_num_to_char(SEXP x, SEXP digits, SEXP na_as_string, SEXP use_signif) {
}
} else if(isReal(x)) {
int precision = asInteger(digits);
+ int sig_digits = signif ? ceil(fmin(15, precision)) : 0;
double * xreal = REAL(x);
for (int i=0; i<len; i++) {
double val = xreal[i];
@@ -47,26 +49,27 @@ SEXP R_num_to_char(SEXP x, SEXP digits, SEXP na_as_string, SEXP use_signif) {
} else {
SET_STRING_ELT(out, i, mkChar("null"));
}
- } else if(precision == NA_INTEGER){
- snprintf(buf, 32, "%.15g", val);
- SET_STRING_ELT(out, i, mkChar(buf));
- } else if(signif){
- //use signifant digits rather than decimal digits
- snprintf(buf, 32, "%.*g", (int) ceil(fmin(15, precision)), val);
- SET_STRING_ELT(out, i, mkChar(buf));
- } else if(precision > -1 && precision < 10 && fabs(val) < 2147483647 && fabs(val) > 1e-5) {
- //preferred method: fast with fixed decimal digits
- //does not support large numbers or scientific notation
- modp_dtoa2(val, buf, precision);
- SET_STRING_ELT(out, i, mkChar(buf));
- //Rprintf("Using modp_dtoa2\n");
} else {
- //fall back on sprintf (includes scientific notation)
- //limit total precision to 15 significant digits to avoid noise
- //funky formula is mostly to convert decimal digits into significant digits
- snprintf(buf, 32, "%.*g", (int) ceil(fmin(15, fmax(1, log10(val)) + precision)), val);
+ if(precision == NA_INTEGER){
+ snprintf(buf, 32, "%.15g", val);
+ } else if(signif){
+ //use signifant digits rather than decimal digits
+ snprintf(buf, 32, "%.*g", sig_digits, val);
+ } else if(precision > -1 && precision < 10 && fabs(val) < 2147483647 && fabs(val) > 1e-5) {
+ //preferred method: fast with fixed decimal digits
+ //does not support large numbers or scientific notation
+ modp_dtoa2(val, buf, precision);
+ } else {
+ //fall back on sprintf (includes scientific notation)
+ //limit total precision to 15 significant digits to avoid noise
+ //funky formula is mostly to convert decimal digits into significant digits
+ snprintf(buf, 32, "%.*g", (int) ceil(fmin(15, fmax(1, log10(val)) + precision)), val);
+ }
+ //if always_decimal = TRUE, then append .0 to whole numbers
+ if(always_dec && strspn(buf, "0123456789-") == strlen(buf)){
+ strcat(buf, ".0");
+ }
SET_STRING_ELT(out, i, mkChar(buf));
- //Rprintf("Using sprintf with precision %d digits\n",(int) ceil(fmin(15, fmax(1, log10(val)) + precision)));
}
}
} else {
diff --git a/src/push_parser.c b/src/push_parser.c
index e05df9d..4e3b3f2 100644
--- a/src/push_parser.c
+++ b/src/push_parser.c
@@ -1,7 +1,7 @@
#include <Rinternals.h>
#include <yajl_tree.h>
#include <yajl_parse.h>
-#include <push_parser.h>
+#include "push_parser.h"
/* finalizer */
yajl_handle push_parser;
diff --git a/src/r-base64.c b/src/r-base64.c
new file mode 100644
index 0000000..c13c193
--- /dev/null
+++ b/src/r-base64.c
@@ -0,0 +1,32 @@
+#include <Rinternals.h>
+#include <stdlib.h>
+#include <string.h>
+#include "base64.h"
+
+SEXP R_base64_encode(SEXP buf){
+ if(TYPEOF(buf) != RAWSXP)
+ Rf_error("base64 buf must be raw");
+ size_t len = Rf_length(buf);
+ size_t outlen = 0;
+ unsigned char * out = base64_encode(RAW(buf), len, &outlen);
+ if(out == NULL)
+ Rf_error("Error in base64 encode");
+ SEXP res = PROTECT(allocVector(STRSXP, 1));
+ SET_STRING_ELT(res, 0, mkCharLen((char*) out, outlen));
+ UNPROTECT(1);
+ return res;
+}
+
+SEXP R_base64_decode(SEXP buf){
+ if(TYPEOF(buf) != RAWSXP)
+ Rf_error("base64 buf must be raw");
+ size_t len = Rf_length(buf);
+ size_t outlen = 0;
+ unsigned char * out = base64_decode(RAW(buf), len, &outlen);
+ if(out == NULL)
+ Rf_error("Error in base64 decode");
+ SEXP res = allocVector(RAWSXP, outlen);
+ memcpy(RAW(res), out, outlen);
+ free(out);
+ return res;
+}
diff --git a/src/yajl/yajl_gen.c b/src/yajl/yajl_gen.c
index bf7629a..98be42a 100644
--- a/src/yajl/yajl_gen.c
+++ b/src/yajl/yajl_gen.c
@@ -221,7 +221,7 @@ yajl_gen_integer(yajl_gen g, long long int number)
return yajl_gen_status_ok;
}
-#if defined(_WIN32) || defined(WIN32)
+#if defined(_WIN32) && !defined(isnan)
#include <float.h>
#define isnan _isnan
#define isinf !_finite
diff --git a/src/yajl/yajl_tree.c b/src/yajl/yajl_tree.c
index da48d21..f8c1e40 100644
--- a/src/yajl/yajl_tree.c
+++ b/src/yajl/yajl_tree.c
@@ -517,10 +517,15 @@ void yajl_tree_free (yajl_val v)
* Stuff below added by Jeroen to support push parsing over connection interface.
*/
+yajl_callbacks mem_callbacks;
+context_t mem_ctx;
+
yajl_handle push_parser_new () {
/* init callback handlers */
- yajl_callbacks *callbacks = malloc(sizeof(yajl_callbacks));
+ yajl_callbacks *callbacks = &mem_callbacks;
+ memset(callbacks, 0, sizeof(yajl_callbacks));
+
callbacks->yajl_null = handle_null;
callbacks->yajl_boolean = handle_boolean;
callbacks->yajl_number = handle_number;
@@ -534,11 +539,8 @@ yajl_handle push_parser_new () {
callbacks->yajl_end_array = handle_end_array;
/* init context */
- context_t *ctx = malloc(sizeof(context_t));
- ctx->root = NULL;
- ctx->stack = NULL;
- ctx->errbuf = malloc(1024);
- ctx->errbuf_size = 1024;
+ context_t *ctx = &mem_ctx;
+ memset(ctx, 0, sizeof(context_t));
/* init handle */
yajl_handle handle = yajl_alloc(callbacks, NULL, ctx);
diff --git a/src/yajl/yajl_version.c b/src/yajl/yajl_version.c
index 71c1450..618ac1b 100644
--- a/src/yajl/yajl_version.c
+++ b/src/yajl/yajl_version.c
@@ -1,4 +1,4 @@
-#include <api/yajl_version.h>
+#include "api/yajl_version.h"
int yajl_version(void)
{
diff --git a/tests/run-all.R b/tests/testthat.R
similarity index 68%
rename from tests/run-all.R
rename to tests/testthat.R
index 87fe983..bf862b7 100644
--- a/tests/run-all.R
+++ b/tests/testthat.R
@@ -4,4 +4,4 @@
library(testthat)
#filter is to disable tests that rely on external servers
-test_package("jsonlite", filter="toJSON|fromJSON|libjson|serializeJSON")
+test_check("jsonlite", filter="toJSON|fromJSON|libjson|serializeJSON")
diff --git a/inst/tests/flatten.R b/tests/testthat/flatten.R
similarity index 100%
rename from inst/tests/flatten.R
rename to tests/testthat/flatten.R
diff --git a/inst/tests/helper-toJSON.R b/tests/testthat/helper-toJSON.R
similarity index 100%
rename from inst/tests/helper-toJSON.R
rename to tests/testthat/helper-toJSON.R
diff --git a/inst/tests/issues.txt b/tests/testthat/issues.txt
similarity index 100%
rename from inst/tests/issues.txt
rename to tests/testthat/issues.txt
diff --git a/inst/tests/readme.txt b/tests/testthat/readme.txt
similarity index 100%
rename from inst/tests/readme.txt
rename to tests/testthat/readme.txt
diff --git a/inst/tests/test-fromJSON-NA-values.R b/tests/testthat/test-fromJSON-NA-values.R
similarity index 100%
rename from inst/tests/test-fromJSON-NA-values.R
rename to tests/testthat/test-fromJSON-NA-values.R
diff --git a/inst/tests/test-fromJSON-array.R b/tests/testthat/test-fromJSON-array.R
similarity index 100%
rename from inst/tests/test-fromJSON-array.R
rename to tests/testthat/test-fromJSON-array.R
diff --git a/inst/tests/test-fromJSON-dataframe.R b/tests/testthat/test-fromJSON-dataframe.R
similarity index 100%
rename from inst/tests/test-fromJSON-dataframe.R
rename to tests/testthat/test-fromJSON-dataframe.R
diff --git a/inst/tests/test-fromJSON-datasets.R b/tests/testthat/test-fromJSON-datasets.R
similarity index 100%
rename from inst/tests/test-fromJSON-datasets.R
rename to tests/testthat/test-fromJSON-datasets.R
diff --git a/inst/tests/test-fromJSON-date.R b/tests/testthat/test-fromJSON-date.R
similarity index 100%
rename from inst/tests/test-fromJSON-date.R
rename to tests/testthat/test-fromJSON-date.R
diff --git a/inst/tests/test-fromJSON-matrix.R b/tests/testthat/test-fromJSON-matrix.R
similarity index 100%
rename from inst/tests/test-fromJSON-matrix.R
rename to tests/testthat/test-fromJSON-matrix.R
diff --git a/inst/tests/test-libjson-escaping.R b/tests/testthat/test-libjson-escaping.R
similarity index 100%
rename from inst/tests/test-libjson-escaping.R
rename to tests/testthat/test-libjson-escaping.R
diff --git a/inst/tests/test-libjson-large.R b/tests/testthat/test-libjson-large.R
similarity index 100%
rename from inst/tests/test-libjson-large.R
rename to tests/testthat/test-libjson-large.R
diff --git a/inst/tests/test-libjson-utf8.R b/tests/testthat/test-libjson-utf8.R
similarity index 100%
rename from inst/tests/test-libjson-utf8.R
rename to tests/testthat/test-libjson-utf8.R
diff --git a/inst/tests/test-libjson-validator.R b/tests/testthat/test-libjson-validator.R
similarity index 100%
rename from inst/tests/test-libjson-validator.R
rename to tests/testthat/test-libjson-validator.R
diff --git a/inst/tests/test-network-Github.R b/tests/testthat/test-network-Github.R
similarity index 100%
rename from inst/tests/test-network-Github.R
rename to tests/testthat/test-network-Github.R
diff --git a/inst/tests/test-serializeJSON-datasets.R b/tests/testthat/test-serializeJSON-datasets.R
similarity index 100%
rename from inst/tests/test-serializeJSON-datasets.R
rename to tests/testthat/test-serializeJSON-datasets.R
diff --git a/inst/tests/test-serializeJSON-functions.R b/tests/testthat/test-serializeJSON-functions.R
similarity index 100%
rename from inst/tests/test-serializeJSON-functions.R
rename to tests/testthat/test-serializeJSON-functions.R
diff --git a/inst/tests/test-serializeJSON-types.R b/tests/testthat/test-serializeJSON-types.R
similarity index 100%
rename from inst/tests/test-serializeJSON-types.R
rename to tests/testthat/test-serializeJSON-types.R
diff --git a/inst/tests/test-toJSON-AsIs.R b/tests/testthat/test-toJSON-AsIs.R
similarity index 100%
rename from inst/tests/test-toJSON-AsIs.R
rename to tests/testthat/test-toJSON-AsIs.R
diff --git a/inst/tests/test-toJSON-Date.R b/tests/testthat/test-toJSON-Date.R
similarity index 100%
rename from inst/tests/test-toJSON-Date.R
rename to tests/testthat/test-toJSON-Date.R
diff --git a/inst/tests/test-toJSON-NA-values.R b/tests/testthat/test-toJSON-NA-values.R
similarity index 100%
rename from inst/tests/test-toJSON-NA-values.R
rename to tests/testthat/test-toJSON-NA-values.R
diff --git a/inst/tests/test-toJSON-NULL-values.R b/tests/testthat/test-toJSON-NULL-values.R
similarity index 100%
rename from inst/tests/test-toJSON-NULL-values.R
rename to tests/testthat/test-toJSON-NULL-values.R
diff --git a/inst/tests/test-toJSON-POSIXt.R b/tests/testthat/test-toJSON-POSIXt.R
similarity index 100%
rename from inst/tests/test-toJSON-POSIXt.R
rename to tests/testthat/test-toJSON-POSIXt.R
diff --git a/inst/tests/test-toJSON-complex.R b/tests/testthat/test-toJSON-complex.R
similarity index 100%
rename from inst/tests/test-toJSON-complex.R
rename to tests/testthat/test-toJSON-complex.R
diff --git a/inst/tests/test-toJSON-dataframe.R b/tests/testthat/test-toJSON-dataframe.R
similarity index 100%
rename from inst/tests/test-toJSON-dataframe.R
rename to tests/testthat/test-toJSON-dataframe.R
diff --git a/inst/tests/test-toJSON-factor.R b/tests/testthat/test-toJSON-factor.R
similarity index 100%
rename from inst/tests/test-toJSON-factor.R
rename to tests/testthat/test-toJSON-factor.R
diff --git a/inst/tests/test-toJSON-keep-vec-names.R b/tests/testthat/test-toJSON-keep-vec-names.R
similarity index 100%
rename from inst/tests/test-toJSON-keep-vec-names.R
rename to tests/testthat/test-toJSON-keep-vec-names.R
diff --git a/inst/tests/test-toJSON-logical.R b/tests/testthat/test-toJSON-logical.R
similarity index 100%
rename from inst/tests/test-toJSON-logical.R
rename to tests/testthat/test-toJSON-logical.R
diff --git a/inst/tests/test-toJSON-matrix.R b/tests/testthat/test-toJSON-matrix.R
similarity index 100%
rename from inst/tests/test-toJSON-matrix.R
rename to tests/testthat/test-toJSON-matrix.R
diff --git a/inst/tests/test-toJSON-numeric.R b/tests/testthat/test-toJSON-numeric.R
similarity index 55%
rename from inst/tests/test-toJSON-numeric.R
rename to tests/testthat/test-toJSON-numeric.R
index fd81557..40c5e09 100644
--- a/inst/tests/test-toJSON-numeric.R
+++ b/tests/testthat/test-toJSON-numeric.R
@@ -3,9 +3,9 @@ context("toJSON Numeric")
test_that("Encoding Numbers", {
expect_that(toJSON(35), equals("[35]"));
expect_that(toJSON(35L), equals("[35]"));
- expect_that(toJSON(c(35, pi), digits=5), equals("[35,3.14159]"));
- expect_that(toJSON(pi, digits=0), equals("[3]"));
- expect_that(toJSON(pi, digits=2), equals("[3.14]"));
+ expect_that(toJSON(c(35, pi), digits=5), equals("[35,3.14159]"));
+ expect_that(toJSON(pi, digits=0), equals("[3]"));
+ expect_that(toJSON(pi, digits=2), equals("[3.14]"));
expect_that(toJSON(pi, digits=10), equals("[3.1415926536]"));
expect_that(toJSON(c(pi, NA), na="string", digits=5), equals("[3.14159,\"NA\"]"));
expect_that(toJSON(c(pi, NA), na="null", digits=5), equals("[3.14159,null]"));
@@ -14,11 +14,33 @@ test_that("Encoding Numbers", {
test_that("Encoding Numbers in Data Frame", {
expect_that(toJSON(data.frame(foo=35)), equals("[{\"foo\":35}]"));
expect_that(toJSON(data.frame(foo=35L)), equals("[{\"foo\":35}]"));
- expect_that(toJSON(data.frame(foo=c(35, pi)), digits=5), equals("[{\"foo\":35},{\"foo\":3.14159}]"));
- expect_that(toJSON(data.frame(foo=pi), digits=0), equals("[{\"foo\":3}]"));
- expect_that(toJSON(data.frame(foo=pi), digits=2), equals("[{\"foo\":3.14}]"));
+ expect_that(toJSON(data.frame(foo=c(35, pi)), digits=5), equals("[{\"foo\":35},{\"foo\":3.14159}]"));
+ expect_that(toJSON(data.frame(foo=pi), digits=0), equals("[{\"foo\":3}]"));
+ expect_that(toJSON(data.frame(foo=pi), digits=2), equals("[{\"foo\":3.14}]"));
expect_that(toJSON(data.frame(foo=pi), digits=10), equals("[{\"foo\":3.1415926536}]"));
- expect_that(toJSON(data.frame(foo=c(pi, NA)), digits=5), equals("[{\"foo\":3.14159},{}]"));
+ expect_that(toJSON(data.frame(foo=c(pi, NA)), digits=5), equals("[{\"foo\":3.14159},{}]"));
expect_that(toJSON(data.frame(foo=c(pi, NA)), na="string", digits=5), equals("[{\"foo\":3.14159},{\"foo\":\"NA\"}]"));
expect_that(toJSON(data.frame(foo=c(pi, NA)), na="null", digits=5), equals("[{\"foo\":3.14159},{\"foo\":null}]"));
});
+
+test_that("Force decimal works", {
+ # Force decimal for doubles
+ expect_equal(toJSON(100), '[100]')
+ expect_equal(toJSON(100, always_decimal = TRUE), '[100.0]')
+ expect_equal(toJSON(12.000000000001, always_decimal = TRUE), '[12.0]')
+
+ # But not for integers
+ expect_equal(toJSON(100L), '[100]')
+ expect_equal(toJSON(100L, always_decimal = TRUE), '[100]')
+
+ # Test range
+ x <- 10^c(-15 : 20)
+ x1 <- c(rev(-x), x)
+ x2 <- 1.2345 * x1
+ expect_equal(as.list(x1), fromJSON(toJSON(x1), simplifyVector = FALSE))
+ expect_equal(as.list(x2), fromJSON(toJSON(x2, digits = 9), simplifyVector = FALSE))
+
+ # always_decimal makes sure that doubles stay real
+ y2 <- fromJSON(toJSON(x1, digits = 9, always_decimal = TRUE), simplifyVector = FALSE)
+ expect_identical(as.list(x1), y2)
+})
diff --git a/inst/tests/test-toJSON-raw.R b/tests/testthat/test-toJSON-raw.R
similarity index 100%
rename from inst/tests/test-toJSON-raw.R
rename to tests/testthat/test-toJSON-raw.R
diff --git a/inst/tests/test-toJSON-zerovec.R b/tests/testthat/test-toJSON-zerovec.R
similarity index 100%
rename from inst/tests/test-toJSON-zerovec.R
rename to tests/testthat/test-toJSON-zerovec.R
diff --git a/inst/tests/testS4.R b/tests/testthat/testS4.R
similarity index 100%
rename from inst/tests/testS4.R
rename to tests/testthat/testS4.R
diff --git a/vignettes/json-apis.Rmd b/vignettes/json-apis.Rmd
index c55d0b9..0daac40 100644
--- a/vignettes/json-apis.Rmd
+++ b/vignettes/json-apis.Rmd
@@ -1,6 +1,6 @@
---
title: "Fetching JSON data from REST APIs"
-date: "2015-09-06"
+date: "2016-05-09"
output:
html_document
vignette: >
@@ -34,36 +34,36 @@ paste(format(gg_issues$user$login), ":", gg_issues$title)
```
```
- [1] "idavydov : annotate(\"segment\") wrong position if limits are inverted"
- [2] "ben519 : geom_polygon doesn't make NA values grey when using continuous fill"
- [3] "has2k1 : Fix multiple tiny issues in the position classes"
- [4] "neggert : Problem with geom_bar position=fill and faceting"
- [5] "robertzk : Fix typo in geom_linerange docs."
- [6] "lionel- : stat_bar() gets confused with numeric discrete data?"
- [7] "daattali : Request: support theme axis.ticks.length.x and axis.ticks.length.y"
- [8] "sethchandler : Documentation error on %+replace% ?"
- [9] "daattali : dev version 1.0.1.9003 has some breaking changes"
-[10] "lionel- : Labels"
-[11] "nutterb : legend for `geom_line` colour disappears when `alpha` < 1.0"
-[12] "wch : scale_name property should be removed from Scale objects"
-[13] "wch : scale_details arguments in Coords should be renamed panel_scales or scale"
-[14] "wch : ScalesList-related functions should be moved into ggproto object"
-[15] "wch : update_geom_defaults and update_stat_defaults should accept Geom and Stat objects"
-[16] "wch : Make some ggproto objects immutable. Closes #1237"
-[17] "and3k : Control size of the border and padding of geom_label"
-[18] "hadley : Consistent argument order and formatting for layer functions"
-[19] "hadley : Consistently handle missing values"
-[20] "cmohamma : fortify causes fatal error"
-[21] "lionel- : Flawed `label_bquote()` implementation"
-[22] "beroe : Create alias for `colors=` in `scale_color_gradientn()`"
-[23] "and3k : hjust broken in y facets"
-[24] "joranE : Allow color bar guides for alpha scales"
-[25] "hadley : dir = \"v\" also needs to swap nrow and ncol"
-[26] "joranE : Add examples for removing guides"
-[27] "lionel- : New approach for horizontal layers"
-[28] "bbolker : add horizontal linerange geom"
-[29] "hadley : Write vignette about grid"
-[30] "hadley : Immutable flag for ggproto objects"
+ [1] "tdsmith : stat_binhex weight aesthetic is undocumented"
+ [2] "huelf : geom_contour throws error when ggplot aes uses shape"
+ [3] "davidkretch : Fix typo in Extending ggplot2 vignette"
+ [4] "janschulz : data used in geom_text with geom specific aes is longer than it should be?"
+ [5] "janschulz : Add top margin to default plot.caption"
+ [6] "wch : Preserve class when adding uneval objects"
+ [7] "coolbutuseless : corrected theme inhertiance for legend.key.size"
+ [8] "has2k1 : Fix geom_dotplot y limit calculations"
+ [9] "shreyasgm : Typo in error message while saving large plots"
+[10] "DarwinAwardWinner : Ordering of multiple legends is seemingly random"
+[11] "noamross : geom_dotplot extends past axis"
+[12] "aosmith16 : geom_dotplot negates free y scale from facet_wrap"
+[13] "lfaller : How to customize x-axis labels for a stacked bar plot graph?"
+[14] "kfeng123 : How can I axis.ticks while using theme_minimal()?"
+[15] "richardbeare : Design query - connectograms"
+[16] "gcpoole : Plotting SpatialLinesDataFrame connects all of the individual lines"
+[17] "zeehio : [Feature Request] different scales by facet"
+[18] "salauer : geom_smooth parameters no longer available in qplot"
+[19] "luczkovichj : Contour labels using direct.label"
+[20] "coolbutuseless : geom_hex/stat_hex binwidth argument no longer working"
+[21] "HughParsonage : annotate() won't expand when position aesthetics are length 1"
+[22] "whao89 : geom_hex no longer recognizes ..density.. in 2.1.0"
+[23] "paul4forest : X axis doesn't appear below facet_wrap plot with uneven number of facets"
+[24] "DarioS : Allow a Vector of Numbers for label_wrap_gen's Width Parameter"
+[25] "coolbutuseless : stat_bin_2d creates an (almost) unkillable legend."
+[26] "dutri001 : Online documentation: HTML table not properly generated from Latex doc "
+[27] "krlmlr : Conditional examples are not rendered"
+[28] "juliangehring : Facets break grouping of data points"
+[29] "holgerbrandl : segfault on macos when using ggsave in parallelized loop "
+[30] "JestonBlu : Added new economic theme"
```
## CitiBike NYC
@@ -94,7 +94,7 @@ nrow(stations)
```
```
-[1] 509
+[1] 508
```
## Ergast
@@ -191,7 +191,7 @@ filings[1:10, c("organization.sub_name", "organization.city", "totrevenue")]
## New York Times
-The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/docs/reference/keys). The code below includes some example keys for illustration purposes.
+The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/signup). The code below includes some example keys for illustration purposes.
```r
@@ -204,13 +204,13 @@ colnames(articles)
```
```
- [1] "web_url" "snippet" "lead_paragraph"
- [4] "abstract" "print_page" "blog"
- [7] "source" "multimedia" "headline"
-[10] "keywords" "pub_date" "document_type"
-[13] "news_desk" "section_name" "subsection_name"
-[16] "byline" "type_of_material" "_id"
-[19] "word_count"
+ [1] "web_url" "snippet" "lead_paragraph"
+ [4] "abstract" "print_page" "blog"
+ [7] "source" "multimedia" "headline"
+[10] "keywords" "pub_date" "document_type"
+[13] "news_desk" "section_name" "subsection_name"
+[16] "byline" "type_of_material" "_id"
+[19] "word_count" "slideshow_credits"
```
```r
@@ -242,12 +242,10 @@ colnames(reviews)
```
```
- [1] "nyt_movie_id" "display_title" "sort_name"
- [4] "mpaa_rating" "critics_pick" "thousand_best"
- [7] "byline" "headline" "capsule_review"
-[10] "summary_short" "publication_date" "opening_date"
-[13] "dvd_release_date" "date_updated" "seo_name"
-[16] "link" "related_urls" "multimedia"
+ [1] "display_title" "mpaa_rating" "critics_pick"
+ [4] "byline" "headline" "summary_short"
+ [7] "publication_date" "opening_date" "date_updated"
+[10] "link" "multimedia"
```
```r
@@ -255,12 +253,12 @@ reviews[1:5, c("display_title", "byline", "mpaa_rating")]
```
```
- display_title byline mpaa_rating
-1 Tom at the Farm Stephen Holden NR
-2 A Little Chaos Stephen Holden R
-3 Big Game Andy Webster PG13
-4 Balls Out Andy Webster R
-5 Mad Max: Fury Road A. O. Scott R
+ display_title byline mpaa_rating
+1 Dheepan A. O. SCOTT R
+2 Mothers and Daughters NEIL GENZLINGER PG-13
+3 Phantom of the Theater DANIEL M. GOLD
+4 Beautiful Something STEPHEN HOLDEN Not Rated
+5 Elstree 1976 NEIL GENZLINGER
```
## CrunchBase
@@ -289,12 +287,18 @@ print(drone_bills[1:5, c("title", "state", "chamber", "type")])
```
```
- title state chamber type
-1 WILDLIFE-TECH il lower bill
-2 Criminalizes the unlawful use of an unma ny lower bill
-3 Criminalizes the unlawful use of an unma ny lower bill
-4 Relating to: criminal procedure and prov wi lower bill
-5 Relating to: criminal procedure and prov wi upper bill
+ title state chamber
+1 An act relating to privacy protection vt upper
+2 Crimes: emergency personnel. ca lower
+3 DRONE TASK FORCE APPT il lower
+4 Omnibus K-12 and higher education policy mn lower
+5 Relates to prohibiting civilian drone us ny upper
+ type
+1 bill
+2 bill, fiscal committee, local program
+3 bill
+4 bill
+5 bill
```
```r
@@ -308,11 +312,11 @@ summary(wordcount)
```
count day raw_count
Min. : 1.00 Min. :1996-01-02 Min. : 1.00
- 1st Qu.: 3.00 1st Qu.:2001-01-22 1st Qu.: 3.00
- Median : 8.00 Median :2005-11-16 Median : 8.00
- Mean : 25.27 Mean :2005-10-02 Mean : 25.27
- 3rd Qu.: 21.00 3rd Qu.:2010-05-12 3rd Qu.: 21.00
- Max. :1835.00 Max. :2015-08-05 Max. :1835.00
+ 1st Qu.: 3.00 1st Qu.:2001-03-26 1st Qu.: 3.00
+ Median : 8.00 Median :2006-03-21 Median : 8.00
+ Mean : 24.91 Mean :2006-01-30 Mean : 24.91
+ 3rd Qu.: 21.00 3rd Qu.:2010-12-08 3rd Qu.: 21.00
+ Max. :1835.00 Max. :2016-04-27 Max. :1835.00
```
```r
@@ -340,10 +344,9 @@ consumer_key = "EZRy5JzOH2QQmVAe9B4j2w";
consumer_secret = "OIDC4MdfZJ82nbwpZfoUO4WOLTYjoRhpHRAWj6JMec";
#Use basic auth
-library(httr)
-secret <- RCurl::base64(paste(consumer_key, consumer_secret, sep = ":"));
-req <- POST("https://api.twitter.com/oauth2/token",
- add_headers(
+secret <- openssl::base64_encode(paste(consumer_key, consumer_secret, sep = ":"));
+req <- httr::POST("https://api.twitter.com/oauth2/token",
+ httr::add_headers(
"Authorization" = paste("Basic", secret),
"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8"
),
@@ -355,22 +358,21 @@ token <- paste("Bearer", content(req)$access_token)
#Actual API call
url <- "https://api.twitter.com/1.1/statuses/user_timeline.json?count=10&screen_name=Rbloggers"
-req <- GET(url, add_headers(Authorization = token))
-json <- content(req, as = "text")
+req <- httr::GET(url, add_headers(Authorization = token))
+json <- httr::content(req, as = "text")
tweets <- fromJSON(json)
substring(tweets$text, 1, 100)
```
```
- [1] "Analysing longitudinal data: Multilevel growth models (II) http://t.co/unUxszG7VJ #rstats"
- [2] "RcppDE 0.1.4 http://t.co/3qPhFzoOpj #rstats"
- [3] "Minimalist Maps http://t.co/fpkNznuCoX #rstats"
- [4] "Tutorials freely available of course I taught: including ggplot2, dplyr and shiny http://t.co/WsxX4U"
- [5] "Deploying Shiny apps with shinyapps.io http://t.co/tjef1pbKLt #rstats"
- [6] "Bootstrap Evaluation of Clusters http://t.co/EbY7ziKCz5 #rstats"
- [7] "Add external code to Rmarkdown http://t.co/RCJEmS8gyP #rstats"
- [8] "Linear models with weighted observations http://t.co/pUoHpvxAGC #rstats"
- [9] "dplyr 0.4.3 http://t.co/ze3zc8t7qj #rstats"
-[10] "xkcd survey and the power to shape the internet http://t.co/vNaKhxWxE4 #rstats"
+ [1] "Rblpapi 0.3.4 https://t.co/NoGluTGSld #rstats #DataScience"
+ [2] "Introducing DohaR – A new R User Group in Doha, Qatar https://t.co/MWSKgMap9I #rstats #DataScience"
+ [3] "FSA v0.8.7 Released https://t.co/2nnGMGINA7 #rstats #DataScience"
+ [4] "Too Much Parallelism is as Bad https://t.co/t0RffUvLYs #rstats #DataScience"
+ [5] "Coming up: principal components analysis https://t.co/f9dUnhuC9n #rstats #DataScience"
+ [6] "Shiny Apps Gallery using Plotly in R https://t.co/cEFvgy1VPY #rstats #DataScience"
+ [7] "Who is going down? Bundesliga Betting Odds – updated https://t.co/uvpcmOmcaf #rstats #DataScience"
+ [8] "BH 1.60.0-2 https://t.co/kZHVjPzG65 #rstats #DataScience"
+ [9] "Red herring bites https://t.co/IJQwBQkImx #rstats #DataScience"
+[10] "R Tools for Visual Studio 3.0 now available https://t.co/JWKthTwEnC #rstats #DataScience"
```
-
diff --git a/vignettes/json-apis.Rmd.orig b/vignettes/json-apis.Rmd.orig
index da5df05..d71c5d9 100644
--- a/vignettes/json-apis.Rmd.orig
+++ b/vignettes/json-apis.Rmd.orig
@@ -89,7 +89,7 @@ filings[1:10, c("organization.sub_name", "organization.city", "totrevenue")]
## New York Times
-The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/docs/reference/keys). The code below includes some example keys for illustration purposes.
+The New York Times has several APIs as part of the NYT developer network. These interface to data from various departments, such as news articles, book reviews, real estate, etc. Registration is required (but free) and a key can be obtained at [here](http://developer.nytimes.com/signup). The code below includes some example keys for illustration purposes.
```{r}
#search for articles
@@ -161,10 +161,9 @@ consumer_key = "EZRy5JzOH2QQmVAe9B4j2w";
consumer_secret = "OIDC4MdfZJ82nbwpZfoUO4WOLTYjoRhpHRAWj6JMec";
#Use basic auth
-library(httr)
-secret <- RCurl::base64(paste(consumer_key, consumer_secret, sep = ":"));
-req <- POST("https://api.twitter.com/oauth2/token",
- add_headers(
+secret <- openssl::base64_encode(paste(consumer_key, consumer_secret, sep = ":"));
+req <- httr::POST("https://api.twitter.com/oauth2/token",
+ httr::add_headers(
"Authorization" = paste("Basic", secret),
"Content-Type" = "application/x-www-form-urlencoded;charset=UTF-8"
),
@@ -176,9 +175,8 @@ token <- paste("Bearer", content(req)$access_token)
#Actual API call
url <- "https://api.twitter.com/1.1/statuses/user_timeline.json?count=10&screen_name=Rbloggers"
-req <- GET(url, add_headers(Authorization = token))
-json <- content(req, as = "text")
+req <- httr::GET(url, add_headers(Authorization = token))
+json <- httr::content(req, as = "text")
tweets <- fromJSON(json)
substring(tweets$text, 1, 100)
```
-
diff --git a/vignettes/json-paging.Rmd b/vignettes/json-paging.Rmd
index 14860b2..7a7f965 100644
--- a/vignettes/json-paging.Rmd
+++ b/vignettes/json-paging.Rmd
@@ -1,6 +1,6 @@
---
title: "Combining pages of JSON data with jsonlite"
-date: "2015-09-06"
+date: "2016-05-09"
output:
html_document
vignette: >
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-jsonlite.git
More information about the debian-science-commits
mailing list