Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How do I get Spark2.r to work with GoogleVis in the HDP Sandbox

Highlighted

How do I get Spark2.r to work with GoogleVis in the HDP Sandbox

New Contributor

Greetings,

In the HDP Sandbox, I am inside the Zeppelin Demo.

However, it appears that GoogleVis is having issues with Spark2.r.

One of the demo calls:

%spark2.r
library(googleVis)
bubble <- gvisBubbleChart(Fruits, idvar="Fruit",   xvar="Sales", yvar="Expenses",  colorvar="Year", sizevar="Profit",  options=list(  hAxis='{minValue:75, maxValue:125}'))
print(bubble, tag = 'chart')

Fails to run:

Error: package or namespace load failed for 'googleVis':
 .onLoad failed in loadNamespace() for 'googleVis', details:
  call: rematchDefinition(definition, fdef, mnames, fnames, signature)
  error: methods can add arguments to the generic 'toJSON' only if '...' is an argument to the generic

This happens for ALL the paragraphs in the demo.

How do I repair?

Thanks!

1 REPLY 1

Re: How do I get Spark2.r to work with GoogleVis in the HDP Sandbox

New Contributor

Hi,

I have found that it is related with SparkR (not Zeppelin) (2.2.1 and 2.3.0)

For example:

[maria_dev@sandbox-hdp mapreduce]$ sparkR
SPARK_MAJOR_VERSION is set to 2, using Spark2
R version 3.5.0 (2018-04-23) -- "Joy in Playing"
. . .
    ____              __
   / __/__  ___ _____/ /__
  _\ \/ _ \/ _ `/ __/  '_/
 /___/ .__/\_,_/_/ /_/\_\   version  2.3.0.2.6.5.0-292
    /_/
. . .
> library(googleVis)
Error: package or namespace load failed for ‘googleVis’:
 .onLoad failed in loadNamespace() for 'googleVis', details:
  call: rematchDefinition(definition, fdef, mnames, fnames, signature)
  error: methods can add arguments to the generic ‘toJSON’ only if '...' is an argument to the generic

I have found that it is was fixed in 2.3.1 version

But, I have found workaround here.

It works also in Zeppelin

%spark2.r
detach("package:SparkR")
library(googleVis)
bubble <- gvisBubbleChart(Fruits, idvar="Fruit", 
                          xvar="Sales", yvar="Expenses",
                          colorvar="Year", sizevar="Profit",
                          options=list(
                            hAxis='{minValue:75, maxValue:125}'))
print(bubble, tag = 'chart')

87512-googlevis.jpg

Kind regards

Krzysztof