Background: 

I have an R Shiny web app that allows a user to input a file in any 
arbitrary format (e.g., .csv, .tsv), but after read in the file exists on 
the R server as an R dataframe. I'd like to make use of google visuals 
without relying on the R package for google visualization and simply use my 
own HTML and javascript to interact with google charts.

Question: 

I'm trying to learn how to convert my R dataframe to a datable table that 
can subsequently be passed to the google charting functions. Something as 
in here is R code to create a simple dataframe.

> tmp <- data.frame(v1 = rep(1:4), v2 = rnorm(4))
> tmp
  v1         v2
1  1 -1.9372140
2  2 -1.5234370
3  3  0.2374601
4  4  1.0550744

Now supposing this is sitting on the R server, I *think* it would be 
represented as a datatable such as:

var data = google.visualization.arrayToDataTable([
  ['v1', 'v2'],
  ['1', -1.9372140],
  ['2', -1.5234370],
  ['3', 0.2374601],
  ['4', 1.0550744]
]);

If so, I could then use various google charts for visual display of these 
data. The resources I'm reviewing include this one below, but if anyone has 
support or worked examples I would be grateful.

https://developers.google.com/chart/interactive/docs/queries

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/60b479a3-eccf-4042-b892-c1aacccce338%40googlegroups.com.

Reply via email to