Error in data.frame(year = c(years, 2022:2026), cases = c(cases, as.numeric(forecast_values$mean)), :

arguments imply differing number of rows: 57, 52

the code used is

forecast_data <- data.frame(

year = c(years, 2022:2026),

cases = c(cases, as.numeric(forecast_values$mean)),

lower = c(rep(NA, length(years)), as.numeric(forecast_values$lower[, "95%"])),

upper = c(rep(NA, length(years)), as.numeric(forecast_values$upper[, "95%"]))

)

Hi, welcome to the forum

I think we need to see your code and some sample data.

Copy the code and paste it here between

```

```

See

FAQ Asking Questions

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where *mydata* is your data. Copy the output and paste it here between

```

```

In general, this type of error implies that when you are passing a list, dataframe column, etc. that they have different numbers of observations. When this occurs, R is telling you that the behavior you are trying to achieve isn't possible.

```
forecast_data <- data.frame(
year = c(years, 2022:2026),
cases = c(cases, as.numeric(forecast_values$mean)),
lower = c(rep(NA, length(years)), as.numeric(forecast_values$lower[, "95%"])),
upper = c(rep(NA, length(years)), as.numeric(forecast_values$upper[, "95%"]))
)
```

So in the case of the above code, either `year`

, `cases`

, `lower`

or `upper`

or some combination of them have 57 rows and some have 52. By checking the length of each of them separately, you'll find which are the issue.

Best,

Randy