I have a plotly object (one of the examples from the ggplotly help). When I try to post it on plotly using api_create() I get the following message:
Error: lexical error: invalid char in json text.
!DOCTYPE html>
(right here) ------^
Any ideas how to figure out what is going on?
The R code is:
if (!require(devtools)) install.packages(“devtools”)
if (!require(plotly)) install.packages(“plotly”)
if (!require(ggplot2)) devtools::install_github(‘hadley/ggplot2’)
if (!require(maps)) install.packages(“maps”)
data(canada.cities, package = “maps”)
viz <- ggplot(canada.cities, aes(long, lat)) +
borders(regions = “canada”) +
coord_equal() +
geom_point(aes(text = name, size = pop), colour = “red”, alpha = 1/2)
TestPlot <- ggplotly(viz, tooltip = c(“text”, “size”))
api_create(TestPlot,filename = “Test”)
R version 3.4.0
Package versions are:
[1] plotly_4.7.0 devtools_1.13.2 maps_3.2.0 ggplot2_2.2.1.9000[details=Summary]This text will be hidden[/details]