Converting large JSON data into multidimensional array

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Converting large JSON data into multidimensional array

philip_rhoades
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:  [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.