Skip to content

Instantly share code, notes, and snippets.

@neerajnagi
Last active September 1, 2016 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neerajnagi/fb1d189e5024a894cff2f8784b41dc8d to your computer and use it in GitHub Desktop.
Save neerajnagi/fb1d189e5024a894cff2f8784b41dc8d to your computer and use it in GitHub Desktop.
guidelines for R code modification w.r.t ( json input and multimodel )

R algo will require multiple algos for a particular gauge based on model information. Also there is a frequent change in input structure of input.

To handle these things a unified json will be provided which will have following #####1) header containing machine details ( model, name, company, zone etc ) #####2) All the available statistics for all the collectors of all the subassemblies of a machines. #####3) raw data in 2d array format under collector

This will be the only input everything else will be sourced statically.

@neerajnagi
Copy link
Author

  1. header section

header

@neerajnagi
Copy link
Author

neerajnagi commented Aug 29, 2016

  1. Statistics section (e.g. statistics of R of ac1 under blower )
    stats

@neerajnagi
Copy link
Author

  1. Raw data will follow two dimensional array format. key used is CSV.
    for accelerometer [ [ 1, 2.2, 3] , [3, 4.4, 2], ...... ]
    for vac [ [9.2] , [10], [10.1], ........... ]

e.g. CSV of ac1

rawac

e.g. CSV of vac1

rawvac

@neerajnagi
Copy link
Author

how to generate json string from R Objects

> library(RJSONIO)
> oilCheck = list( "color"="red", "trend"=3 )
> beltTension = list("color"="green","trend"=2)
>
>
> all = list( "Oil Check"=oilCheck, "Belt Tension"=beltTension)
> toJSON(all)
[1] "{\n \"Oil Check\": {\n \"color\": \"red\",\n\"trend\":      3 \n},\n\"Belt Tension\": {\n \"color\": \"green\",\n\"trend\":      2 \n} \n}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment