zoo

Rollapply: what does by.column do?

删除回忆录丶 提交于 2020-03-06 02:27:52
问题 I have read the description of by.column for rollapply in the manual but I couldn't understand how to use it. see below: x=matrix(1:60,nrow=10) library('zoo') rollapply(x,3,mean,fill=NA,align="right",by.column=FALSE) [1] NA NA 27 28 29 30 31 32 33 34 when i use by.column= FALSE : it applies mean to width (3) rolling number of lines mean(x[1:3,]) now, if I use by.column=TRUE then I get: x=matrix(1:60,nrow=10) rollapply(x,3,mean,fill=NA,align="right",by.column=TRUE) [,1] [,2] [,3] [,4] [,5] [,6

Zookeeper3.4.5 分布式搭建

让人想犯罪 __ 提交于 2020-03-01 05:02:50
Hadoop 分布式集群搭建完成的基础上 一、修改zoo.cfg dataDir=/disk/zookeeper/data dataLogDir=/disk/zookeeper/logs server.1=vm-007:2888:3888 server.2=vm-008:2888:3888 server.3=vm-009:2888:3888 二、创建myid文件 在 dataDir 目录下,创建文件myid,并写入相应的数字 vm-007,写1 vm-008,写2 vm-007,写3 在vm-007执行命令: scp zoo.cfg lwj@vm-008 :/opt/software/zookeeper-3.4.5/conf scp zoo.cfg lwj@vm-009 :/opt/software/zookeeper-3.4.5/conf 三、启动/停止 启动命令:lwj@vm-009:/opt/software/zookeeper-3.4.5$ ./bin/zkServer.sh start JMX enabled by default Using config: /opt/software/zookeeper-3.4.5/bin/../conf/zoo.cfg Usage: ./bin/zkServer.sh {start|start-foreground|stop

zookeeper-3.4.14详细安装

人盡茶涼 提交于 2020-02-26 14:08:39
(1)解压并安装 tar -zxvf zookeeper-3.4.14.tar.gz -C /opt/ (2)修改配置文件 cd /opt/zookeeper-3.4.14/conf scp zoo_sample.cfg zoo.cfg vi zoo.cfg dataDir=/opt/zookeeper-3.4.14/zkdata dataLogDir=/opt/zookeeper-3.4.14/log server.1=master:2888:3888 server.2=slaver01:2888:3888 server.3=slaver02:2888:3888 来源: https://www.cnblogs.com/Louis-Victory/p/12366476.html

Zookeeper修改运行日志zookeeper.out输出路径

99封情书 提交于 2020-02-20 10:18:47
前言 Zookeeper中运行日志 zookeeper.out 文件的输出路径默认为启动脚本的当前路径,导致Zookeeper集群启动失败时总是不记得输出日志在哪儿,不便于查找错误原因,因此很有必要设置固定路径来保存运行日志 在本次实验之前已经将 dataDir 和 dataLogDir 分别设置为 $ZOOKEEPER_HOME/zkData 和 $ZOOKEEPER_HOME/logs/transaction ,都是在 $ZOOKEEPER_HOME/conf/zoo.cfg 中配置。值得注意的是在此 zoo.cfg 文件中配置必须使用 绝对路径 ,不能使用环境变量 $ZOOKEEPER_HOME ,此处是为了描述方便才使用此变量名 本次实验将把运行日志文件 zookeeper.out 输出路径指定为 $ZOOKEEPER_HOME/logs/runtime/ 路径下 简单配置 修改 $ZOOKEEPER_HOME/bin/zkEnv.sh 将 ZOO_LOG_DIR 设置成自定义路径,本次设置为 $ZOOBINDIR/../logs/runtime ,其中 ZOOBINDIR 变量是此脚本开头获取的Zookeeper的bin路径,我们直接以此来定位自己的日志路径即可。具体如下: # 修改前 54 if [ "x ${ZOO_LOG_DIR} " = "x" ] 55 then

Spring9:Autowire(自动装配)机制

笑着哭i 提交于 2020-02-13 08:43:12
为什么Spring要支持Autowire(自动装配) 先写几个类,首先定义一个Animal接口表示动物: 1 public interface Animal { 2 3 public void eat(); 4 5 } 写一个Animal接口的实现Tiger类: 1 public class Tiger implements Animal { 2 3 @Override 4 public void eat() { 5 System.out.println("Tiger.eat()"); 6 } 7 8 @Override 9 public String toString() { 10 return "I'm a tiger"; 11 } 12 } 写一个动物园类Zoo,持有Animal接口,表示动物园中有动物: 1 public class Zoo { 2 3 private Animal animal; 4 5 public Animal getAnimal() { 6 return animal; 7 } 8 9 public void setAnimal(Animal animal) { 10 this.animal = animal; 11 } 12 13 @Override 14 public String toString() { 15 if (animal ==

Pivot by group for unequal data size

◇◆丶佛笑我妖孽 提交于 2020-02-05 05:13:27
问题 I have the following DF: DF = structure(list(ID = c(21785L, 21785L, 21785L), V1 = c(0.828273303, 6.404590021, 0.775568448), V2 = c(2L, 3L, 2L), V3 = c(NA, 1.122899914, 0.850113234), V4 = c(NA, 4L, 3L), V5 = c(NA, 0.866757168, 0.868943246 ), V6 = c(NA, 5L, 4L), V7 = c(NA, 0.563804788, 0.728656328), V8 = c(NA, 6L, 5L), V9 = c(NA, 0.888109208, 0.823803733), V10 = c(NA, 7L, 6L), V11 = c(NA, 0.578834113, 0.863467391 ), V12 = c(NA, 1L, 7L), V13 = c(NA, NA, 0.939920869)), class = "data.frame", row

A Byte of Python3 学习笔记

时光怂恿深爱的人放手 提交于 2020-02-04 12:48:46
A Byte of Python3 学习笔记 第七章 控制流 1.if语句(带输入函数) 2.while语句 3.for循环 4.break、continue、return的区别 第八章 函数 8.1简介 8.2函数参数 8.3局部变量 8.4全局变量——类似于C#中的静态变量 8.6默认参数 8.7 关键参数 8.8VarArgs参数 8.9Keyworld-only参数 8.10 return语句 9.4模块的__name__ 第10章 数据结构 10.2列表 10.4元组 10.5字典 pycharm 小技巧 1.批量注释快捷键 python常见错误 1.Non-ASCII character'\xe6' in file”错误 第七章 控制流 1.if语句(带输入函数) #if语句 number=23 #input() 数据输入函数,int()将字符串转换成int guess=int(input('Enter an integer :')) if guess==number: # New block starts here print('Congratulations,you guessec it.') # New block end here print('(but you do not win any prizes)') elif guess<number: print(

rolling regression with dplyr

和自甴很熟 提交于 2020-01-29 05:36:45
问题 I have a dataframe of "date", "company" and "return", reproducible by the code below: library(dplyr) n.dates <- 60 n.stocks <- 2 date <- seq(as.Date("2011-07-01"), by=1, len=n.dates) symbol <- replicate(n.stocks, paste0(sample(LETTERS, 5), collapse = "")) x <- expand.grid(date, symbol) x$return <- rnorm(n.dates*n.stocks, 0, sd = 0.05) names(x) <- c("date", "company", "return") With this dataframe, I can calculate the daily market average return and add that result into a new column "market

rolling regression with dplyr

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-29 05:36:11
问题 I have a dataframe of "date", "company" and "return", reproducible by the code below: library(dplyr) n.dates <- 60 n.stocks <- 2 date <- seq(as.Date("2011-07-01"), by=1, len=n.dates) symbol <- replicate(n.stocks, paste0(sample(LETTERS, 5), collapse = "")) x <- expand.grid(date, symbol) x$return <- rnorm(n.dates*n.stocks, 0, sd = 0.05) names(x) <- c("date", "company", "return") With this dataframe, I can calculate the daily market average return and add that result into a new column "market

Backward replacement of NAs in time series only to a limited number of observations

时光总嘲笑我的痴心妄想 提交于 2020-01-22 02:16:13
问题 In a data table I want to perform a forward and backward gap-filling procedure over a period of 3 days in both directions. # Example data: library(data.table) library(zoo) dt <- data.table(Value = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, 0.1359223, NA, NA, NA, NA, 0.0000000, 0.0000000, 0.0000000, 0.0000000, 0.0000000, NA)) > dt Value 1: NA 2: NA 3: NA 4: NA 5: NA 6: NA 7: NA 8: NA 9: NA 10: 0.1359223 11: NA 12: NA 13: NA 14: NA 15: 0.0000000 16: 0.0000000 17: 0.0000000 18: 0.0000000 19: 0