POSIXct values become numeric in reshape2 dcast

后端 未结 3 1829
长情又很酷
长情又很酷 2021-01-12 23:55

I\'m trying to use dcast from the latest reshape2 package (1.2.1) to denormalize a data frame (or data.table) where the value.var is a POSIXct type, but in the resulting dat

3条回答
  •  误落风尘
    2021-01-13 00:24

    Pre- and/or post-processing for dates integrity when casting/widening a dataset can be very cumbersome.

    In that respect, unless the reshaping you need is complicated, pivot_wider() from package tidyr is respectful of dates objects -- no conversion along the way. In addition, it gives a lot more control over the casting/widening process, thus avoiding post-processing steps (https://tidyr.tidyverse.org/reference/pivot_wider.html).

提交回复
热议问题