R按小时费率排算

时间:2017-11-28 03:37:43

标签: r dataframe time-series

我开始使用R,所以请耐心等待我

例如,我有这个try { FileInputStream fileInput = new FileInputStream(fileName); Scanner fileIn = new Scanner(new FileReader(fileName)); String fileWord = fileIn.next(); ArrayList<String> newSubList = new ArrayList<>(); while (fileIn.hasNext()){ fileWord = fileIn.next(); //Adds to this specific Arraylist: newSubList.add(fileWord); } //Adds to the outermost ArrayList after loop fileByLine.add(newSubList); } catch (IOException ex) { System.out.println("Error reading file."); } (或data.table)对象:

data.frame

我的最终目标是将“时间”列分组为每小时,并根据每小时时间和工作站对Time Station count_starts count_ends 01/01/2015 00:30 A 2 3 01/01/2015 00:40 A 2 1 01/01/2015 00:55 B 1 1 01/01/2015 01:17 A 3 1 01/01/2015 01:37 A 1 1 count_starts求和:

count_ends

我做了一些研究,发现我应该使用Time Station sum(count_starts) sum(count_ends) 01/01/2015 01:00 A 4 4 01/01/2015 01:00 B 1 1 01/01/2015 02:00 A 4 2 库。

感谢您帮助我

更新:

我将xts的类型转换为transactions$Time,因此POSIXct包应该可以直接使用时间序列。

0 个答案:

没有答案