如何使用R将当前日期添加到Google工作表名称中?

问题描述 投票:0回答:1

我正在使用R,并尝试使用工作表标题中的今天日期创建一个谷歌工作表。到目前为止,这是我的代码......我不知道我错过了什么,或者这是否可行。任何建议或帮助将不胜感激。


    library(googlesheets)
    register_the_sheet <- gs_title("Sheet Name")
    register_the_sheet <- register_the_sheet %>%
    gs_ws_new(ws_title = today(), input = data, trim = TRUE, verbose = FALSE)
r timestamp r-googlesheets
1个回答
0
投票

我不知道你在哪里得到“今天()”,但是使用更标准的“Sys.time”,你可能想把今天的日期格式化为一个字符串:

  > todayStr<- format(Sys.time(), "%Y%m%d")
  > todayStr
[1] "20180228"
© www.soinside.com 2019 - 2024. All rights reserved.