library(ggplot2)
library(plotly)
# using mpg data set, already loaded as a part of ggplot2
fig<-plot_ly(mpg,x=~cty, y=~hwy,
color=~drv,
frame = ~class,
type="scatter",
mode="markers")
fig
but then it showed me this error
This reprex appears to crash R. See standard output and standard error for more details.
Standard output and error
e[31m✖e[39m Install the e[34mstylere[39m package in order to use `style = TRUE`.
Error : Functions that produce HTML output found in document targeting gfm-yaml_metadata_block output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: true
Note however that the HTML output will not be visible in non-HTML formats.
library(ggplot2)
library(plotly)
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
# using mpg data set, already loaded as a part of ggplot2
fig<-plot_ly(mpg,x=~cty, y=~hwy,
color=~drv,
frame =~class,
type="scatter",
mode="markers")
fig
#> Warning in p$x$data[firstFrame] <- p$x$frames[[1]]$data: number of items to
#> replace is not a multiple of replacement length