Closed areddy647712 closed 2 years ago
Thank you!
It looks like this error is caused by POSIXct columns. I'm not sure why yet. It also looks like the code that is struggling is on lines 72-76 of cb_summary_stats_time.R
It doesn't look like the problem is with a POSIXct column per se. The date_time
column I created in the example study data works just fine. Not, sure what the problem is.
The problem is with calculating the mode when there is a mode value (as opposed to all values occurring exactly one time).
The section of code that calculates the mode value still had the date
column hardcoded into it from when I originally created and test the function. This explains why the date
column had a mode value and didn't throw an error, but other columns with mode value did.
mode <- df %>%
dplyr::count(.data[[.x]], name = "Frequency") %>%
dplyr::filter(Frequency == max(Frequency)) %>%
dplyr::mutate(
Statistic = "Mode",
Percentage = Frequency / nrow(df) * 100,
Value = date
)
Changing the last line Value = date
to Value = .data[[.x]]
fixes the problem.
Hi Brad,
This is the error I received when passing the Master Log data frame to the codebook function.
These are the steps I took:
I hope this was helpful. I also tried to use the cb_add_col_attributes() function and assign attributes to columns with dates in them.
Thank you! Aish