I receive json-files with data to be analyzed in R, for which I use the RJSONIO-package:
library(RJSONIO)
filename <- \"Indata.json\"
jFile <- fromJSON
Not on the memory size, but on the speed, for the quite small iris
dataset (only 7088 bytes), the RJSONIO
package is an order of magnitude slower than rjson
. Don't use the method 'R' unless you really have to! Note the different units in the two sets of results.
library(rjson) # library(RJSONIO)
library(plyr)
library(microbenchmark)
x <- toJSON(iris)
(op <- microbenchmark(CJ=toJSON(iris), RJ=toJSON(iris, method='R'),
JC=fromJSON(x), JR=fromJSON(x, method='R') ) )
# for rjson on this machine...
Unit: microseconds
expr min lq median uq max
1 CJ 491.470 496.5215 501.467 537.6295 561.437
2 JC 242.079 249.8860 259.562 274.5550 325.885
3 JR 167673.237 170963.4895 171784.270 172132.7540 190310.582
4 RJ 912.666 925.3390 957.250 1014.2075 1153.494
# for RJSONIO on the same machine...
Unit: milliseconds
expr min lq median uq max
1 CJ 7.338376 7.467097 7.563563 7.639456 8.591748
2 JC 1.186369 1.234235 1.247235 1.265922 2.165260
3 JR 1.196690 1.238406 1.259552 1.278455 2.325789
4 RJ 7.353977 7.481313 7.586960 7.947347 9.364393