[R] Converting large JSON data into multidimensional array

Philip Rhoades phil at pricom.com.au
Thu Jun 30 01:08:24 CEST 2011


People,

I have output from a Ruby script saved in JSON format and I can import 
it into an R vector (list?) that looks like:

> tst
[[1]]
[[1]][[1]]
[1] "01.01.01.00"

[[1]][[2]]
[1] -2.304248


[[2]]
[[2]][[1]]
[1] "01.01.01.01"

[[2]][[2]]
[1] -2.288097


[[3]]
[[3]][[1]]
[1] "01.01.01.02"

[[3]][[2]]
[1] -2.303347


[[4]]
[[4]][[1]]
[1] "01.01.01.03"

[[4]][[2]]
[1] -2.354964

.
.

I would like to convert the data into a:

     50.32.20.22 array

and be able to do calculations on the array like:

     mean( tst[ 50,,20,00 ] )

etc

Suggestions appreciated.

Thanks,

Phil.

-- 
Philip Rhoades

GPO Box 3411
Sydney NSW    2001
Australia
E-mail:  phil at pricom.com.au



More information about the R-help mailing list