nhs-r-community / NHSRplotthedots

An SPC package to support NHSE/I 'Making Data Count' programme
https://nhs-r-community.github.io/NHSRplotthedots/
Other
48 stars 23 forks source link

Cannot draw a graph with integer value_field #107

Closed ChrisBeeley closed 3 years ago

ChrisBeeley commented 3 years ago
library(magrittr)

test_df <- tibble::tibble(
  "Date" = seq.Date(as.Date("2020-01-01"), as.Date("2021-02-01"), by = "month"),
  "test_quantity" = sample(1L : 10L, 14, replace = TRUE)
)

test_df %>% 
  NHSRplotthedots::ptd_spc(value_field = test_quantity, date_field = Date)
#> Error: Problem with `mutate()` column `mr`.
#> ℹ `mr = case_when(...)`.
#> x must be an integer vector, not a double vector.
#> ℹ The error occurred in group 1: f = "no facet", rebase_group = 0.

Created on 2021-10-25 by the reprex package (v2.0.0)

ChrisBeeley commented 3 years ago

This works fine:

test_df <- tibble::tibble(
  "Date" = seq.Date(as.Date("2020-01-01"), as.Date("2021-02-01"), by = "month"),
  "test_quantity" = rnorm(14)
)