zoo

How do I match data frames by time intervals?

ぃ、小莉子 提交于 2019-12-03 08:24:52
This is a problem that comes up often when I am importing raw data from data loggers. A temperature logger is set to record temperature every ten minutes, and a separate gas logger is set to record gas used in the last ten minute interval. I want to combine the data from these two loggers into a single data frame for plotting and analysis, but the times are not exactly aligned. I want to have one row in the data frame for each ten minute period, with the datetime showing the beginning of the time period. The temperature logger data looks like: datetime temperature 2010-09-30 06:58:53 78.996

Rollapply for time series

こ雲淡風輕ζ 提交于 2019-12-03 07:32:39
问题 I am trying to calculate the rolling 20 period historical volatility. I take the daily returns: ret<-ROC(data1) And then I use rollapply to get the 20 day HV for each column: vol<-rollapply(ret,20,sd,by.column=T,fill=NA) The problem is that observations in vol starts appearing after ten days which is wrong as I specified 20. For demonstration here is sample of the data: 0.000000000, 0.005277045, 0.023622047, 0.002564103,-0.002557545, -0.020512821, 0.007853403,-0.012987013, 0.007894737, 0

regressions with xts in R

人盡茶涼 提交于 2019-12-03 05:01:46
Is there a utility to run regressions using xts objects of the following type: lm(y ~ lab(x, 1) + lag(x, 2) + lag(x,3), data=as.data.frame(coredata(my_xts))) where my_xts is an xts object that contains an x and a y . The point of the question is is there a way to avoid doing a bunch of lags and merges to have a data.frame with all the lags? I think that the package dyn works for zoo objects so i would expect it to work the same way with xts but though there might be something updated. G. Grothendieck The dyn and dynlm packages can do that with zoo objects. In the case of dyn just write dyn$lm

Converting zoo to ts before forecasting

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am struggling to convert a zoo objects to a ts object. I have a huge data.frame "test" with quarterly hour data, which looks like this: date <- c("2010-07-04 09:45:00", "2010-07-04 10:00:00", "2010-07-04 10:15:00", "2010-07-04 10:30:00", "2010-07-04 10:45:00", "2010-07-04 11:00:00") nrv <- c("-147.241", "-609.778", "-432.289", "-340.418", "-73.96" , "-533.108") tt <- c("3510.7", "3608.5", "3835.7", "4003.7", "4018.8", "4411.9") test <- data.frame(date,nrv,tt) test I want to make some predictions (mostly ARIMA ) and thought the forecast

Different dates formats in zoo

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am finding differences in behavior between two environments running R 2.12.1. In the first one zoo behaves as expected. > library ( zoo ) > x . date <- as . Date ( paste ( 2003 , 2 , c ( 1 , 3 , 7 , 9 , 14 ), sep = "-" )) > x <- zoo ( rnorm ( 5 ), x . date ) > index ( x ) [ 1 ] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14" > as . Date ( index ( x )) [ 1 ] "2003-02-01" "2003-02-03" "2003-02-07" "2003-02-09" "2003-02-14" > sessionInfo () R version 2.12 . 1 ( 2010 - 12 - 16 ) Platform : x86_64 - unknown - linux -

R/zoo: index entries in ‘order.by’ are not unique

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a .csv file containing 4 columns of data against a column of dates/times at one-minute intervals. Some timestamps are missing, so I'm trying to generate the missing dates/times and assign them NA values in the Y columns. I have previously done this with other .csv files with exactly the same formatting, with no issues. The code is: # read the csv file har10 = read.csv(fpath, header=TRUE); # set date har10$HAR.TS My data looks like this (for an entire year, more or less) after conversion to POSIXct, which seems to go fine: HAR.TS C1 C2

Add missing xts/zoo data with linear interpolation in R

匿名 (未验证) 提交于 2019-12-03 02:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I do have problems with missing data, but I do not have NAs - otherwise would be easier to handle... My data looks like this: time, value 2012-11-30 10:28:00, 12.9 2012-11-30 10:29:00, 5.5 2012-11-30 10:30:00, 5.5 2012-11-30 10:31:00, 5.5 2012-11-30 10:32:00, 9 2012-11-30 10:35:00, 9 2012-11-30 10:36:00, 14.4 2012-11-30 10:38:00, 12.6 As you can see - there are missing some minute values - it is xts/zoo so I use as.POSIXct... to set the date as an index. How to add the missing timesteps to get a full ts? I want to fill the missing values

Error in boost-python nested namespace exporting code

匿名 (未验证) 提交于 2019-12-03 01:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am working on exporting two classes class zoo (extzoo and intzoo namespaces), class animal (extanim and intanim namespaces)" methods which are defined within two level nested namespaces. I want to expose these methods to Python interpreter from where I can access them. I have written code, created a shared library but when I import it into a python I get an error. I will appreciate your guidance on this. I have followed the answer given on the following link in similar context of exposing C++ nested namespaces: create boost

hadoop集群下zookeeper的安装配置

﹥>﹥吖頭↗ 提交于 2019-12-03 00:23:40
1.保证hadoop集群没有问题,可以看下我另一个文章 https://www.cnblogs.com/zhangjiahao/p/10992171.html 2.下载上传zookeeper安装包 官网地址:http://mirror.bit.edu.cn/apache/zookeeper/ 3.解压 tar -zxvf zookeeper-3.4.4.tar.gz 4.进入到conf目录并且拷贝zoo_samle.cfg为zoo.cfg cd zookeeper.2.4.5/conf cp zoo_sample.cfg zoo.cfg 5.编辑zoo.cfg文件(地址和ip按照自己的实际情况来) 6.创建myid文件并写入1 创建文件:touch myid 7.将配置好的文件传到slave1和slave2,修改myid中的数字为2,3 8.配置环境变量分发到另外两个机器上 9.启动 到bin目录下 ./zkServer.sh start 查询状态 ./zkServer.sh status 来源: https://www.cnblogs.com/zhangjiahao/p/11768898.html

一起走进动物园管理员――ZooKeeper

匿名 (未验证) 提交于 2019-12-02 23:49:02
作者:汤小洋 来源: http://blog.51cto.com/12402007/2331203 一、ZooKeeper简介 1. ZooKeeper是什么 官网 https://zookeeper.apache.org/ 2. ZooKeeper组成 2.1 文件系统 数据模型结构是一种树形结构,由许多节点构成 每个节点叫做ZNode(ZooKeeper Node) 每个节点对应一个唯一路径,通过该路径来标识节点,如 /app1/p_2 每个节点只能存储大约1M的数据 持久化目录节点 persistent 客户端与服务器断开连接,该节点仍然存在 持久化顺序编号目录节点 persistent_sequential 客户端与服务器断开连接,该节点仍然存在,此时节点会被顺序编号,如:000001、000002..... 临时目录节点 ephemeral 客户端与服务器断开连接,该节点会被删除 临时顺序编号目录节点 ephemeral_sequential 客户端与服务器断开连接,该节点会被删除,此时节点会被顺序编号,如:000001、000002..... 2.2 通知机制 观察者模式 设计的分布式服务管理框架 ZooKeeper负责管理和维护项目的公共数据,并授受观察者的注册(订阅) 一旦这些数据发生变化,ZooKeeper就会通知已注册的观察者 此时观察者就可以做出相应的反应 3