You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
brookslogan
changed the title
Verify that print for epi_slide shows values from the added column
Verify that print shows values from the added column in epi_slide examples
Jun 2, 2022
I had a quick look at this yesterday and it may be the long column names are causing the issue... When we consider the sum of the characters for the column names and the whitespaces, the line with the column names surpasses the default of ~80 characters per line (there are 85 characters printed in the console for the column names line in the first epi_slide ex.).
We can look at that first epi_slide example to see this better:
library(epiprocess)
c <- b <- a <- jhu_csse_daily_subset %>%
group_by(geo_value) %>%
epi_slide(cases_7dav = mean(cases), n = 7,
align = "right")
colnames(a)
# sum(nchar(colnames(a))) + num of whitespaces in-between colnames + 3 whitespaces at beginning (before geo_value)
sum(nchar(colnames(a))) + 6 + 3
So, the key takeaway here is that the sum of the characters on that line is 85.
When we use any width of 85 or above, all of the columns are printed as intended.
Or when we reduce the number of characters in the column names so that the total printed in that line (when whitespaces are included) <= 80, then it also works.
names(b) = 1:7
b
colnames(c)[4] = "death_7d_av"
withr::with_options(list(width=85L), print(c))
So, if you really want the added column to be printed, one solution is to shorten 1+ of the column names to ensure that the default width of 80 is not surpassed.
Seems like it's system or version dependent. Maybe because I have
? Or maybe it's a version thing (I am on
tibble_3.1.7
, R version 4.0.5 (2021-03-31)).You can probably recreate what I'm seeing with
withr::with_options(list(width=80L), print(a))
.Experiments:
Originally posted by @brookslogan in #77 (comment)
The text was updated successfully, but these errors were encountered: