我正在通过在一个需要从日志中提取唯一路径的项目中使用它来学习R.
现在,我的解决方法(较低)部分代码工作,但我不得不将日志分成两个文件,并分别对它们进行分组,而我在变量上尝试相同,我得到了所有三个中的所有数据路径计数。
有人能指出我在第一种方法中出了什么问题,因为我怀疑将物理文件写入磁盘是有意的吗?
a = read.csv('download-report-06-10-2017.csv')
yesterdays_data <- a[grepl("2017-10-05", a$Download.Time), ]
todays_data <- a[grepl("2017-10-06", a$Download.Time), ]
write.csv(yesterdays_data, "yesterdays.csv")
write.csv(todays_data, "todays.csv")
path_count <- as.data.frame(table(a$Path))
path_count_today <- as.data.frame(table(todays_data$Path))
path_count_yday <- as.data.frame(table(yesterdays_data$Path))
#### path_count, path_count_today & path_count_yday contain the same values and I expect them to be different ???
yd = read.csv('yesterdays.csv')
td = read.csv('todays.csv')
path_count_td <- as.data.frame(table(td$Path))
path_count_yd <- as.data.frame(table(yd$Path))
#### path_count_td and path_count_yd are different, as I'd expect in upper three variables