在 `timetk` 中,函数 `tk_make_weekend_sequence` 的结果什么都不显示

In `timetk` ,the result of function `tk_make_weekend_sequence` show nothing

timetk中,函数tk_make_weekend_sequence的结果什么都不显示。任何人都可以帮忙吗?谢谢!

library(timetk)

weekends <- tk_make_weekend_sequence(
  start_date = "2017-01-01",
  end_date   = "2017-12-31"
)

weekends

要解决此问题,您需要为 "LC_TIME"

设置英语环境
Sys.setlocale("LC_TIME", "English")

weekends <- tk_make_weekend_sequence(
  start_date = "2017-01-01",
  end_date   = "2017-12-31"
)

weekends

函数 tk_make_weekend_sequence 使用一个 lubridate::wday 函数,该函数与您的本地语言设置兼容。

ret_tbl <- tibble::tibble(date_sequence = date_sequence) %>%
    dplyr::mutate(weekday = lubridate::wday(date_sequence, label = TRUE)) %>%
    dplyr::filter((weekday == "Sat" | weekday == "Sun"))

问题是由最后一行的filter触发的。如果您不更改 "LC_TIME",工作日将是您母语中日期名称的缩写。