[R] (no subject)
Kwesi Quagraine
starskykwesi at gmail.com
Mon Jan 30 18:26:22 CET 2017
Hello Eric, thanks for the code, it seems to do something closer to what I
want. I generate JFM, FMA and so on, but it does not create the DJF at the
beginning. Any thoughts on that?
Kwesi
On Mon, Jan 30, 2017 at 6:01 PM, Erich Subscriptions <
erich.subs at neuwirth.priv.at> wrote:
> Using dplyr and magrittr you could do the following
>
>
> -=-=-=-=-
> library(dplyr)
> library(magrittr)
>
> mydata <- read.table(text="
> era...1. Node_freq MEI
> 1 1980-01-01 -0.389855332 0.3394196488
> 2 1980-02-01 -0.728019153 0.2483738232
> 3 1980-03-01 -1.992457784 0.3516954904
> 4 1980-04-01 0.222760284 0.5736836269
> 5 1980-05-01 0.972601798 0.6289249144
> 6 1980-06-01 0.570725954 0.5736836269
> 7 1980-07-01 -0.977966324 0.4120517119
> 8 1980-08-01 0.056128836 -0.0104418383
> 9 1980-09-01 0.987304573 -0.0687520861
> 10 1980-10-01 1.188242495 -0.1403611624
> 11 1980-11-01 1.693037763 -0.0963727298
> 12 1980-12-01 1.173539720 -0.2539126977
> 13 1981-01-01 0.423698206 -0.6140040528
> 14 1981-02-01 -2.208098481 -0.5209122536
> 15 1981-03-01 -0.786830252 0.1133395650
> 16 1981-04-01 -0.110502611 0.3302127675
> 17 1981-05-01 -1.272021820 -0.1894645290
> 18 1981-06-01 0.394292656 -0.3736021538
> 19 1981-07-01 1.452892441 -0.4032687711
> 20 1981-08-01 0.698150002 -0.4441882433
> 21 1981-09-01 0.997106423 -0.1720737534
> 22 1981-10-01 0.247264908 -0.2436828296
> 23 1981-11-01 0.771663876 -0.3909929295
> 24 1981-12-01 -0.316341458 -0.4943145967
> ")
>
> mydata %<>% mutate(Node_freq2=lead(Node_freq,1),Node_freq3=lead(Node_
> freq,2),MEI1=lead(MEI,1),MEI2=lead(MEI,3)) %>%
> select(1,2,4,5,3,6,7)
>
> -=-==-=
>
> check if mydata ist what you want
>
>
>
>
>
>
--
Try not to become a man of success but rather a man of value-Albert Einstein
University of Cape Coast|College of Agriculture and Natural Sciences|Department
of Physics|
Team Leader|Recycle Up! Ghana|Technology Without Borders|
Other emails: kwesi.quagraine at ucc.edu.gh|kwesi.quagraine at teog.de|
Mobile: +233266173582
Skype: quagraine_cwasi
Twitter: @Pkdilly
[[alternative HTML version deleted]]
More information about the R-help
mailing list