@rexevan and @Uday Thanks for commenting on my query. Regarding random values I mean to say about the position i.e., the wrong values are recorded randomly by the sensor. They are outliers.
Below is a subset of my actual data set I generated using "dput" command. You can see in the data that in this period there is no snow but the sensor records sometimes 3.42 or 0.22 meters etc values of snow and which are outliers.
datain <- structure(list(date = structure(c(1470681000, 1470684600, 1470688200,
1470691800, 1470695400, 1470699000, 1470702600, 1470706200, 1470709800,
1470713400, 1470717000, 1470720600, 1470724200, 1470727800, 1470731400,
1470735000, 1470738600, 1470742200, 1470745800, 1470749400, 1470753000,
1470756600, 1470760200, 1470763800, 1470767400, 1470771000, 1470774600,
1470778200, 1470781800, 1470785400, 1470789000, 1470792600, 1470796200,
1470799800, 1470803400, 1470807000, 1470810600, 1470814200, 1470817800,
1470821400, 1470825000, 1470828600, 1470832200, 1470835800, 1470839400,
1470843000, 1470846600, 1470850200, 1470853800, 1470857400, 1470861000,
1470864600, 1470868200, 1470871800, 1470875400, 1470879000, 1470882600,
1470886200, 1470889800, 1470893400, 1470897000, 1470900600, 1470904200,
1470907800, 1470911400, 1470915000, 1470918600, 1470922200, 1470925800,
1470929400, 1470933000, 1470936600, 1470940200, 1470943800, 1470947400,
1470951000, 1470954600, 1470958200, 1470961800, 1470965400, 1470969000,
1470972600, 1470976200, 1470979800, 1470983400, 1470987000, 1470990600,
1470994200, 1470997800, 1471001400, 1471005000, 1471008600, 1471012200,
1471015800, 1471019400, 1471023000, 1471026600, 1471030200, 1471033800,
1471037400, 1471041000, 1471044600, 1471048200, 1471051800, 1471055400,
1471059000, 1471062600, 1471066200, 1471069800, 1471073400, 1471077000,
1471080600, 1471084200, 1471087800, 1471091400, 1471095000, 1471098600,
1471102200, 1471105800, 1471109400, 1471113000, 1471116600, 1471120200,
1471123800, 1471127400, 1471131000, 1471134600, 1471138200, 1471141800,
1471145400, 1471149000, 1471152600, 1471156200, 1471159800, 1471163400,
1471167000, 1471170600, 1471174200, 1471177800, 1471181400, 1471185000,
1471188600, 1471192200, 1471195800, 1471199400, 1471203000, 1471206600,
1471210200, 1471213800, 1471217400, 1471221000, 1471224600, 1471228200,
1471231800, 1471235400, 1471239000, 1471242600, 1471246200, 1471249800,
1471253400, 1471257000, 1471260600, 1471264200, 1471267800, 1471271400,
1471275000, 1471278600, 1471282200, 1471285800, 1471289400, 1471293000,
1471296600, 1471300200, 1471303800, 1471307400, 1471311000, 1471314600,
1471318200, 1471321800, 1471325400, 1471329000, 1471332600, 1471336200,
1471339800, 1471343400, 1471347000, 1471350600, 1471354200, 1471357800,
1471361400, 1471365000, 1471368600, 1471372200, 1471375800, 1471379400,
1471383000, 1471386600, 1471390200, 1471393800, 1471397400, 1471401000,
1471404600, 1471408200, 1471411800, 1471415400, 1471419000, 1471422600,
1471426200, 1471429800, 1471433400, 1471437000, 1471440600, 1471444200,
1471447800, 1471451400, 1471455000, 1471458600, 1471462200, 1471465800,
1471469400, 1471473000, 1471476600, 1471480200, 1471483800, 1471487400,
1471491000, 1471494600, 1471498200, 1471501800, 1471505400, 1471509000,
1471512600, 1471516200, 1471519800, 1471523400, 1471527000, 1471530600,
1471534200, 1471537800, 1471541400, 1471545000, 1471548600, 1471552200,
1471555800, 1471559400, 1471563000, 1471566600, 1471570200, 1471573800,
1471577400, 1471581000, 1471584600, 1471588200, 1471591800, 1471595400,
1471599000, 1471602600, 1471606200, 1471609800, 1471613400, 1471617000,
1471620600, 1471624200, 1471627800, 1471631400, 1471635000, 1471638600,
1471642200, 1471645800, 1471649400, 1471653000, 1471656600, 1471660200,
1471663800, 1471667400, 1471671000, 1471674600, 1471678200, 1471681800,
1471685400, 1471689000, 1471692600, 1471696200, 1471699800, 1471703400
), class = c("POSIXct", "POSIXt"), tzone = ""), snowdepth2 = c(0,
0.03, 0, 0, 0.01, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02, 0.02,
0.02, 0.04, 0, 0, 0, 0, 0, 0.02, 0.02, 0.01, 0, 0.02, 0.02, 0,
0, 0.02, 0.02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02,
0.02, 0.03, 0.02, 3.42, 0, 0, 0, 0, 0.02, 0.03, 0.03, 0, 0.02,
0, 0.02, 3.42, 0, 0, 0, 0.01, 0, 0.01, 0, 0, 0, 3.42, 0.01, 3.42,
0, 0.01, 0.01, 0.02, 0.02, 0.02, 0.01, 0.02, 0, 0, 0, 0.01, 0.01,
3.42, 0, 0, 0.03, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.01, 0, 0.01, 0,
0.01, 0, 3.42, 0, 0, 3.42, 3.42, 0.02, 0, 3.42, 0.02, 0.03, 0,
0, 0, 0, 0, 0.22, 0.22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01, 3.42,
0.03, 3.42, 0.18, 0, 3.42, 0, 0, 0, 0.21, 0.22, 0.22, 0, 0, 0,
0, 0, 0, 0, 0, 0.21, 0, 0, 0, 0, 0, 3.42, 0.01, 0, 3.42, 0, 3.42,
0, 0, 0.2, 0, 0.2, 0.2, 0, 0.02, 0, 0.01, 0.01, 0.01, 0.21, 0,
0.01, 0.01, 0, 0.04, 0.01, 0.02, 3.42, 0.18, 0, 3.42, 0, 0.2,
0, 0.19, 0, 0, 0, 0.2, 0, 0, 0.01, 0, 0, 0.21, 0, 0.2, 0, 0.21,
0.03, 0.2, 3.42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02, 0.01, 0.01,
0.01, 0, 0.01, 0, 0.02, 0, 0, 3.42, 0.01, 3.42, 0.03, 3.42, 3.42,
0, 0, 0.01, 0.02, 0.02, 0.02, 3.42, 0, 0, 0.02, 0.02, 0.02, 0.01,
0, 0.01, 0, 0, 0.01, 0, 0, 0, 3.42, 0, 0, 0.02, 0.01, 0, 0, 0,
0, 0, 0, 3.42, 0.01, 0.01, 0, 0.02, 0, 0.01, 0.02, 0.01, 0.02,
3.42, 0, 0.15, 0, 0, 0, 0, 0, 0.03)), .Names = c("date", "snowdepth2"
), row.names = c(NA, -285L), class = c("tbl_df", "tbl", "data.frame"
))
Now, I hope I explained by problem very well.
Thanks
John