Hey there, I've been struggling to use tidymodels
on a Shiny dashboard, and I've narrowed it down to recipes
being the crux of the error. Here is the reprex
(Shiny in showcase mode, so you can see all the code, and I tried to make it minimal as possible): https://pathos.shinyapps.io/recipes_not_working
If in need of sample data, feel free to use this code to generate data:
# Generate some data that increases over time
dff_generated <- 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(dff_generated, 'sample_data.csv')
Steps:
- Upload data
- Select
yy
as predicted variable, anddatee
as time variable (though this part really doesn't matter) - See the second table not being rendered
Prerequisites:
- It should be reactive to user uploading the data
- It should be reactive to user selecting variables/columns from the uploaded data
Problem
Just by adding recipes into an otherwise identical code, the code does not work. This is the 'identical code' setup:
You can see that all it needs to do is return dataa
in both cases.
Result
Expected result
Expected result is to show the identical table twice.
It's entirely possible that I'm doing something wrong, but if I am (variable referencing? Maybe I'm supposed to be using {{ }}? I tried a few different things, but no luck), please let me know.
What I searched so far online on this error message didn't help me, and there seems to be very few discussions of it online, which understandable because recipes is relatively recent.