My aim is to create a visual data representation of Temperature data coming from a street light via sensors. I am picking that data from the mongoDB database. Basically in my knowledge and experience, I used Shiny And R to show static data graphs from the database, but I am unable to find any way of showing continuously updating data in a moving line chart. I hope you get the picture.
Please refer to this example using node.js(I want to achieve results similar to this but using R)
https://www.youtube.com/watch?v=nauRfoNNEQs
My questions is, is there a way to show real time data visualization in R or I have to necessarily use node.js with plotly?
I'm not sure how "live" you can get the stream, but you might want to look into this:
https://shiny.rstudio.com/reference/shiny/latest/reactivePoll.html
http://shiny.rstudio.com/gallery/reactive-poll-and-file-reader.html
Related
It's quite an interesting challenge, and I can't say that I entirely know how/the best way to go about it.
Basically I have a data set, I have attached a few picture to try and show you what I am working with. The data was randomly generated but it similar to what I am working with.
I am wanting to take the data, then input the date and value into the report based on the category, and date. The even more challenging part of it is that I need to have to report be filled out for each unique id. So it will have to create many different reports, and then fill it out.
Any idea/questions? I have no idea how to go about it.
I am experienced in R, excel, some python and SQL (but very little).
If you have the dataset in R, you could write a function that takes the parameters needed, performs the aggregation, and writes the result to excel.
It is not clear to me what exactly the data aggregation part is. Without reproducible data it is hard to go into more detail.
I am using shinobicharts ChartFragment. I have scenario that each time I have to load the chart with different data within same activity i.e I am not recreating that activity. But I am failed to do this. It not recreating and not clearing the series which I previously set to that chart.
Can anybody help, how can I remove old series in that chart and load new series each time? I tried shinobiChart().removeSeries() but it didn't work.
Thanks
If you wish to dynamically load new data, you do not necessarily need to remove the series. Instead you can simply add data points to your data adapter. You will find the following methods useful:
https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.7.2/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#add(int, com.shinobicontrols.charts.Data)
https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.7.2/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#add(com.shinobicontrols.charts.Data)
https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.7.2/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#addAll(int, java.util.Collection>)
https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.7.2/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/DataAdapter.html#addAll(java.util.Collection>)
In these api docs you will also find similar methods to remove data points.
One thing to bear in mind is that adding or removing a data point to / from a SimpleDataAdapter class instance which is set on a series will trigger a redraw of that series. If you are working with large numbers of data points, this might not be performant. In this case a more suitable approach might be to temporarily remove the data adapter from the series, perform the modification to the data and then re add the data adapter back to the series. Alternatively you might like to implement your own DataAdapter and control when you instruct the chart to redraw that series (via the fireUpdateHandler method).
You can of course remove the series itself and add a new one, but this approach is potentially inefficient. That said, if you wish to remove a series from a chart you need to use the following method:
https://www.shinobicontrols.com/docs/ShinobiControls/ShinobiChartsAndroid/1.7.2/Premium/Normal/apidocs/docs/reference/com/shinobicontrols/charts/ShinobiChart.html#removeSeries(com.shinobicontrols.charts.Series)
In order for this method to be successful you will first need to obtain a reference to the correct series, which you must pass to this method as a parameter.
I hope that you find this information useful. If you need any further help please if possible post any relevant code, such as that which you use to create your fragments and set up your chart.
Thanks and kind regards,
Kai.
Disclaimer - I work for ShinobiControls.
I am building a BI application
Data Source: Excel file and Microsoft Database
Data Analysis: R
Data Reporting: Tableau Public
My use case is to take 5-6 inputs from the user. Inputs will in like a drop down and multiple selection box. Based on the inputs I need to do the analysis and display it on Tableau.
Question:
How to take user inputs in tableau? like a form? Or what is a alternative for taking user inputs and pass it to Tableau/R?
If I think of making an Web page then how to pass value from page to R and Tableau and return the analysis back to web page?
Please provide you valuable inputs or some alternative to achieve my requirements.
Thank you.
For my use case I am avoiding Tableau due to time constraint, and will be using RStudio for integrating the data and doing the analysis. For the user input and visualization part I will be using Shiny by RStudio ( http://www.rstudio.com/products/shiny/ ). Do check their website.
In future if I find some solution with Tableau then will surely post in here.
Thanks for all the suport.
You can create parameters, and set them on the sheet, so the user can input values there.
http://kb.tableausoftware.com/articles/knowledgebase/using-parameters
Depending on what you're doing, you can use Tableau connection with R. Pretty simple to use, but does not cover everything R can do
http://www.tableausoftware.com/new-features/r-integration
http://kb.tableausoftware.com/articles/knowledgebase/r-implementation-notes
I am fairly new to R and the multiple R mapping packages I haven't completely flushed out their capabilities yet nor necessarily discovered all of the efficient ways to do things; so I apologize if there is an obvious answer but any help is appreciated.
The problem I am trying to solve has the following components.
I want to create a heat map over a map of the United States based
only on city and state data. I do not have zip code or geoencoding
data.
Each day I generate data of a about half a million records that usually have some
form of City and State contained in a single field in them. The data
is inconsistent as far as formatting and frequently has errors or
non-usable data. This I am generally OK with, but it plays into
possibly affecting other functions.
The heat map (sum or count) is desired to be looked at on daily, weekly,
and monthly or ad-hoc intervals. So manually doing data preparation each
interval would likely be inefficient and also limit or not be
efficient enough to use public APIs.
A very large majority of the data will have the same values. A quick
check of the values showed that one value makes up over 10% of the
data consistently over time and the top 100 values (when formatted
correctly) make up easily 25% or more.
The program generating the data is vendor supplied and cannot be programmed to go and
retrieve the geocode data itself and I am basically left to do it in
R.
I only have read only access to the data so cannot create additional
fields to store information like geo-encoding information in the
transaction records and at this time I cannot create another table in the same database
to store the information.
I am aware of the geocode function and this similar post:
[question] Plot on ggmap by using city and state
as well as the getGeoCode built into RgoogleMaps that handles the various spacing of the city state well.
getGeoCode("Anchorage AK")
lat lon
61.21806 -149.90028
What I am looking for guidance or help with is the following:
A) Is there a City library that contains the generic map plot information or is there a basic map package that has this built in that does not need to go out to the net for each record?
B) Is there a simple plot heat map that is something similar straight forward as the following as most examples of map plots I have seen to date are quite larger pieces of code just to call the map function.
plot(DataSource, CityCol, ValueCol)
C) And really the primary question, how (or is there a way) to build a common library or array of already identified locations in R that I could load each time on run-time and if it is not contained in that library only then go out and geocode it using a web resource. Almost a lookup table or library that is really just a custom data array?
I'm trying to use rrdtool to monitor Access Points and what I'd like is to have separate rrd file for each access point, which is something I'm not sure how to do. Anyway if I can do that then for each site I'd be able to get a graph from different rrd databases according to site location. However when I want to see a company level graph I'd like to aggregate data across multiple rrd databases and get that to show on one graph, so if bandwidth is measured for two devices in two separate rrd databases then I would like to get an "average" of these two data sources and show it in my graph for the site that has these access points. Is this possible? I'm quite new to thinking in RRD way and rrdtool so please do let me know if there are better ways of doing this.
Also how RRD uses space internally? From what I read so far, there are people saying the size of file never gets bigger for RRD database. On the other side people asking about how much of file size it would accumulate over years. So I'm kind of confused here. I thought it would be holding stuff in memory and writing to disk based on consolidated functions.
Can I generate pie charts from rrdtool as well? I need to find number of users connected to a access point and it would be good if I can show that as a pie chart for total number of users connected to an access point at any given time for a given site. For instance,
access point 1: 20
access poin 2: 40
access poin 3: 1
If I can generate a pie chart for that it would be sliced according to the number of users.
Sorry it's quite a few questions. If rrdtool doesn't make a big difference then I might as well use Mysql as I have running mysql server in production. And I can produce graphs on the fly using some funky flash stuff too. If someone can enlighten me on pros and cons of using RRD over any RDBMS for time series data that would be amazing.
Many Thanks guys!!
You can aggregate data from multiple RRDs into one graph; you'd use the CDEF command in your rrdgraph statement to combine DEFs from individual databases.
rrd files stay the same size unless you explicitly resize them by adding rows. Older data is aged out and replaced with new data. (Hence the name "round robin database".)
pie charts...I dunno. :) I've never seen it, but that certainly doesn't mean it's not possible.
Have you read the basic tutorial? http://oss.oetiker.ch/rrdtool/tut/rrdtutorial.en.html That might help you decide what to do.
Cacti is what you are after I would say;
It is a web front end to rrdtool (and much more). You can create devices, add them, set up graphs and it will poll them for data into RRD files. You can have all kinds of graphs, and create aggregate ones etc. You can also query against rrd files for monthly/weekly/yearly/any-time-frame statistics you like.
Everything you have asked for can be done with Cacti except for pie charts.