RChart gives blank screen

Here are my details:

    rawData <- structure(list(Date = c("4/30/2015", "5/1/2015", "5/2/2015", 
"5/3/2015", "5/4/2015", "5/5/2015"), Amount = c(23L, 43L, 32L, 
43L, 43L, 32L)), .Names = c("Date", "Amount"), class = "data.frame", row.names = c(NA, 
-6L))

      

The following will open:

rPlot(Amount~Date, data = rawData, type = 'bar')

      

I have no idea why - I am new to rCharts, although I usually use ggplot2.

thanks for the help

+3


source to share


1 answer


I have seen as many tutorials or blogs as I could find about rCharts and there is no example rPlot

used with a type bar

anywhere with a dataset like yours (there is only one here , but it is used as a histogram with bin variables and counters that are not match).

The function rPlot

works great if you change the type bar

to line

, which makes me think you can't use rPlot

in this case.

#this works
p1 <- rPlot(x='Date', y='Amount', data = rawData, type = 'line')
p1

      

It seems to me that if you want to plot a barcode, your best bet is to use a function vPlot

(or hPlot

for a horizontal bar) that works great:

p1 <- vPlot(x='Date', y='Amount', data = rawData, type = 'bar')
p1

      



enter image description here

And actually as per @ Shiva's post below, you can also do (type = 'column' will print it vertically):

hPlot(x='Date', y='Amount', data = rawData, type = 'column')

      

Which actually looks even better:

enter image description here

+2


source







All Articles