jSonarR: jSonar Analytics Platform API for R

Description Details See Also Examples

Description

This package enables users to access MongoDB by running queries and returning their results in R data frames. Usually, data in MongoDB is only available in the form of a JSON document. jSonarR uses data processing and conversion capabilities in the jSonar Analytics Platform and the JSON Studio Gateway (http://www.jsonstudio.com), to convert it to a tabular format which is easy to use with existing R packages.

Details

To use jSonarR, you must have access to a server running JSON Studio. Create a connection using using new.SonarConnection. Now you can run a saved query against a collection in the database using the connection object and sonarAgg or sonarFind.

See Also

MongoDB http://www.mongodb.org

JSON Studio http://www.jsonstudio.com

Examples

1
2
3
4
5
6
7
8
9
connection <- new.SonarConnection('https://example.com', 'localhost', 'test')

ny_by_day <- sonarAgg(connection, 'delays_by_day', 'NYCFlights')
summary(ny_by_day)

tx_to_co <- sonarFind(connection, 'flights_to', 'TXFlights',
  bind=list(state="CO"),
  colClasses=c(DAY_OF_MONTH='factor', DEST_AIRPORT_ID='factor'))
summary(tx_to_co$DEST_AIRPORT_ID)

Example output

Loading required package: RCurl
Loading required package: bitops
Loading required package: jsonlite
   X_id.Month X_id.DayofMonth X_id.Origin     count       X_sum_AirTime   
 Min.   :1    Min.   :1.000   EWR:8       Min.   :480.0   Min.   : 55058  
 1st Qu.:1    1st Qu.:2.500   JFK:8       1st Qu.:677.0   1st Qu.: 74994  
 Median :1    Median :4.000   LGA:7       Median :714.0   Median :111176  
 Mean   :1    Mean   :4.348               Mean   :725.5   Mean   :100839  
 3rd Qu.:1    3rd Qu.:6.000               3rd Qu.:801.0   3rd Qu.:116194  
 Max.   :1    Max.   :8.000               Max.   :904.0   Max.   :126606  
 X_sum_ArrDelay  X_sum_DepDelay  X_avg_AirTime   X_avg_ArrDelay    
 Min.   :-8654   Min.   :  316   Min.   :102.5   Min.   :-12.9940  
 1st Qu.:-3003   1st Qu.: 5125   1st Qu.:124.0   1st Qu.: -4.1625  
 Median : -390   Median : 6980   Median :137.3   Median : -0.5524  
 Mean   : 4657   Mean   :10049   Mean   :141.4   Mean   :  5.6271  
 3rd Qu.: 8627   3rd Qu.:12105   3rd Qu.:165.2   3rd Qu.: 13.6202  
 Max.   :35432   Max.   :42044   Max.   :180.6   Max.   : 40.7264  
 X_avg_DepDelay        month        day        origin 
 Min.   : 0.4731   Min.   :1   Min.   :1.000   EWR:8  
 1st Qu.: 7.0269   1st Qu.:1   1st Qu.:2.500   JFK:8  
 Median : 9.6508   Median :1   Median :4.000   LGA:7  
 Mean   :13.3169   Mean   :1   Mean   :4.348          
 3rd Qu.:17.7014   3rd Qu.:1   3rd Qu.:6.000          
 Max.   :48.3264   Max.   :1   Max.   :8.000          
11292 
   15 

jSonarR documentation built on May 2, 2019, 4:01 p.m.

Related to jSonarR in jSonarR...