Possible bug with integer dates input
Closed this issue · 0 comments
thibautjombart commented
Please place an "x" in all the boxes that apply
- I have the most recent version of incidence2 and R
- I have found a bug
- I have a reproducible example
- I want to request a new feature
I think the following should probably work; I am guessing it has to do with dates being simple numbers (not Date or grates stuff) but not 100% sure. Here's a reprex:
library(incidence2)
df <- data.frame(
dates = 1:100,
counts = round(rnorm(100, 1000, 200))
)
x <- incidence(df, date_index = dates, counts = counts)
x
#> An incidence2 object: 100 x 2
#> 100028 counts from 1 to 100
#> interval: 1 day
#> cumulative: FALSE
#>
#> date_index counts
#> <int> <dbl>
#> 1 1 775
#> 2 2 1389
#> 3 3 1341
#> 4 4 999
#> 5 5 694
#> 6 6 645
#> 7 7 1000
#> 8 8 1365
#> 9 9 1119
#> 10 10 959
#> # … with 90 more rows
plot(x)
#> Error in `substring<-`(`*tmp*`, 1, 1, value = toupper(first_letter)): replacing substrings in a non-character object
Created on 2021-03-29 by the reprex package (v1.0.0)