R - Script Templates

Here you can find some R scripts and snippets which are useful to solve some common problems

Luna connection status
Question: What is the actual connection state of each machine/Luna? Solution: To answer this question with an analytics query a first/last aggregation...
Tue, 26 Mar, 2019 at 2:23 PM
Gap filling
Question: My machine only sends an update to the cloud if the value of a variables has changed. As a result there are empty entries in my analytics query. ...
Tue, 25 Jun, 2019 at 3:33 PM
Duration calculation of overlapping periods
Question: How can I calculate the total duration of overlapping periods (e.g. of a specific error category)? How can I deal with multiple categories if I ...
Tue, 26 Mar, 2019 at 3:49 PM
Bad performance of fill() after group_by()
The actual implementation of the fill method in the tidyr package (V0.8.3) doesn't perform very well if the dataset was grouped with the group_by() met...
Tue, 9 Apr, 2019 at 9:38 AM
Senseforce timestamp and R Date objects
The Senseforce timestamp is formatted as UNIX timestamp with millisecond precision. For our R scripting engine, this looks like an ordinary numeric.  To cr...
Sat, 13 Apr, 2019 at 5:32 PM
Error-Code Mapping Trick
Question: How can we map error message texts to error codes in different languages and with a simple version control?  Solution:  To do so we have ...
Wed, 8 May, 2019 at 10:07 AM
Set operations on time interval information (like alarms, warnings etc.)
Question: How can I perform set operations like union, intersect etc. on data sets with time interval information e.g. alarm start and end? Solution: ...
Tue, 7 May, 2019 at 2:03 PM
How to create a single row Gantt Chart
Question: How can I create a single row gantt chart e.g. to display the state of a machine? Solution: At the moment there is no "gantt chart"...
Tue, 7 May, 2019 at 2:53 PM
Improve performance of your script
If your script has performance issues due to the amount of data you are using, there are some things you can do to decrease the execution time of your scrip...
Thu, 27 Jun, 2019 at 4:44 PM
Transform JSON export from CrateDB into CSV
Because a JSON which got exported from a Crate database is not in the standard JSON format, but a JSON object it needs to be imported in a different way tha...
Wed, 6 Nov, 2019 at 6:02 PM