Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何修复我的XTS(timeseries)以关联到我的CSV文件?_R_Date_Xts - Fatal编程技术网

如何修复我的XTS(timeseries)以关联到我的CSV文件?

如何修复我的XTS(timeseries)以关联到我的CSV文件?,r,date,xts,R,Date,Xts,所以我有一个“日历”,它提醒我需要在excel电子表格上完成某些事情,并通过电子邮件(MailR)发送。有两列,一列是日期,另一列是任务。电子表格的格式如下所示: Date (XTS) Date Task 0001-01-20 1/01/20 Road Trip 0001-10-19 1/10/19 Buy Groceries 0001-11-19 1/11/19 Meeting with manager 0002-01-20 2/01/20 NA 0002-03-20 2/

所以我有一个“日历”,它提醒我需要在excel电子表格上完成某些事情,并通过电子邮件(MailR)发送。有两列,一列是日期,另一列是任务。电子表格的格式如下所示:

Date (XTS)   Date    Task
0001-01-20  1/01/20 Road Trip
0001-10-19  1/10/19 Buy Groceries
0001-11-19  1/11/19 Meeting with manager
0002-01-20  2/01/20 NA
0002-03-20  2/03/20 Dentists
0002-10-19  2/10/19 NA
0002-12-19  2/12/19 Go to the Gym
0003-01-20  3/01/20 Buy Groceries
0003-02-20  3/02/20 Pick up kids
日期(日/月/年)|任务

这是我到目前为止编写的代码:

library(zoo)
library(xts)
library(lubridate)
library(xtable)

setwd('Documents')
getwd()
data <- read.csv(file = 'email_calendar.csv', header = TRUE, sep = ',')
## NA values for blanks to match x(nrows)
data2 <- read.csv(file = 'email_calendar.csv', header = TRUE, sep = ',', na.strings = c('','NA')) 

xtsdata <- xts(data2, order.by = as.Date(data2$Date),"%d/%m/%y")
body = print(xtable(data,caption = '30 Day Tasks'),type='html',caption.placement='top')
我不能按日期排序,当我发送电子邮件给自己作为测试时,日期完全混乱。我不知道如何将这两种日期类型对齐在一起

我想在最终版本是订购的日期,并只显示未来30天,没有在电子邮件中的历史日期


有人能解释一下吗,谢谢?

email\u calendar.csv看起来怎么样?为什么您需要将数据转换为
xts
?@Ronaksah,时间序列将允许我从今天开始只提取任务,不是吗?您是否尝试过执行
xtsdata