Thanks for your reply.
Not exactly minimal reprex I think, but I took a bit of time to reduce it down from the original and the dashboard is in showcase mode, so all of the code is presented there. I also think that the included parts are relevant. Here is the link for it: enet_dashboard
Although the error is more generic on the website, the error I get when running from R Studio is Error: cannot coerce type 'closure' to vector of type 'character'
The part I'm having trouble with is the Plotly output gg_enet
in the 'Model' tab, more specifically the #MODEL
part and below in server.R
.
To clarify, I've been trying to narrow it down, and worked out that at least until this part, it's ok:
folds = dff() |>
sliding_period(lookback = input$lookback, # if Inf, then it's chain
period = input$period,
index = {{ var_time_sym }},
#assess_stop = 1L, # include how many 'periods' in the future
every = input$every, # group how many 'periods' together
step = input$step, # how many 'periods' * 'every' to move the window (?)
skip = input$skip)
(That index = {{ var_time_sym }}
part took a good amount of time to figure out)
Then I un-commented the part after that, which is the #MODEL
part (starting with defining fit_enet
), and that part is where I'm having difficulties, even though it works without reactive programming part with user input from the UI.
In case you need a sample .csv
file to upload into the dashboard, here's some code to generate it:
df <- data.frame(yearr = sample(2015:2021, 2190, replace = TRUE),
monthh = sample(1:12, 2190, replace = TRUE),
dayy = sample(1:29, 2190, replace = TRUE)) |>
mutate(datee = ymd(paste(yearr, monthh, dayy)),
weekk = week(datee),
yy = sample(10000:20000, 2190, replace = TRUE) + (yearr^2) + (monthh^2) + (weekk^2),
dummyy = as.factor(round(sample(0:1, 2190, replace = TRUE)))) |>
filter(!is.na(datee)) |>
arrange(-desc(datee))
write_csv(df, 'sample_data.csv')
After upload, change Select predicted variable
to yy
, Select time variable
to datee
, and click on the 'model' tab.