Round 2. I am creating a quarto/shiny doc that has an echart graphic in it with a simple radio button input widget,and the error that I am running into now is a ‘Error in renderEcharts4r({ : could not find function “renderEcharts4r” ‘. The function does exist in the package though when I am looking through the functions in the packages pane!
Below is a reproducible example. What is the issue here? I’ve also tried downloading the package using devtools but I get the same error.
Thanks
EDIT to include versions:
echarts4r 0.4.5 (downloaded from CRAN)
R version 4.3.2
---
title: "Test"
format: html
server: shiny
execute:
echo: false
warning: false
---
```{r}
#| label: setup
library(dplyr)
library(echarts4r)
library(shinyWidgets)
library(lubridate)
data("USAccDeaths")
USAccDeaths <- data.frame(as.matrix(USAccDeaths), date=time(USAccDeaths))
USAccDeaths$year <- trunc(USAccDeaths$date)
USAccDeaths$month <- (USAccDeaths$date - USAccDeaths$year) * 12 + 1
colnames(USAccDeaths)[1] <- 'Deaths'
```
```{r}
radioGroupButtons(
inputId = "time_period",
label = "Choices",
choices = c("Month", "Year"),
status = "primary"
)
echarts4rOutput("plot1")
```
```{r}
#| context: server
deaths <- reactive({
USAccDeaths %>%
group_by(tolower(input$time_period)) %>%
summarise('Deaths' = sum(deaths))
})
output$plot1 <- renderEcharts4r({
deaths |>
e_charts(x = tolower(input$time_period)) |> # initialise and set x
e_line(serie = Deaths, smooth = TRUE) |>
e_tooltip(trigger = "axis")
})
```
Need version number for everything!