Re: [R] Convert daily data to weekly data

2018-05-29 Thread jim holtman
Forgot the year if you also want to summarise by that. > x <- structure(list(X1986.01.01.10.30.00 = c(16.8181762695312, 16.8181762695312, + 18.8294372558594, 16 [TRUNCATED] > library(tidyverse) > library(lubridate) > # convert to long form >

Re: [R] Convert daily data to weekly data

2018-05-29 Thread jim holtman
try this: > x <- structure(list(X1986.01.01.10.30.00 = c(16.8181762695312, 16.8181762695312, + 18.8294372558594, 16 [TRUNCATED] > library(tidyverse) > library(lubridate) > # convert to long form > x_long <- gather(x, key = 'date', value =

Re: [R] How to generate a conditional dummy in R?

2018-05-29 Thread Jim Lemon
Hi Faradj, Yes, the function expects at least three values for each country. Glad it worked. Jim On Tue, May 29, 2018 at 10:53 PM, Faradj Koliev wrote: > Dear Jim, > > wow! It worked! Thanks a lot. > > I did as you suggested and it worked well with the real data. Although it > gave me this

Re: [R] Excel Add-Ins Not Loaded When Using excel.link & RDCOM

2018-05-29 Thread Jeff Newmiller
RDCOM supports calling R from Excel. AFAIK you need to use the non-free Statconn software [1] to get much done going the other way. FWIW I have found my life to be much simpler only using packages that access the data in Excel rather than trying to control the software remotely. More

[R] Excel Add-Ins Not Loaded When Using excel.link & RDCOM

2018-05-29 Thread Ayhan Yuksel
Dear All, I am using excel.link package to open and modify Excel files. When I manually open Excel, all my add-ins are loaded without a problem. But when I open Excel using excel.link package, like: xls<-xl.get.excel() xl.workbook.open("MyFile.xlsx") some Excel add-ins are (installed but) not

Re: [R] Convert daily data to weekly data

2018-05-29 Thread Miluji Sb
Dear Petr, Thanks for your reply and the solution. The example dataset contains data for the first six days of the year 1986. "X1986.01.01.10.30.00" is 01 January 1986 and the rest of the variable is redundant information. The last date is given as "X2016.12.31.10.30.00". I realized that I

Re: [R] Convert daily data to weekly data

2018-05-29 Thread PIKAL Petr
Hi Based on your explanation I would advice to use ?cut.POSIXt with breaks "week". However your data are rather strange, you have data frame with names which looks like dates names(test) [1] "X1986.01.01.10.30.00" "X1986.01.02.10.30.00" "X1986.01.03.10.30.00" [4] "X1986.01.04.10.30.00"

[R] Convert daily data to weekly data

2018-05-29 Thread Miluji Sb
Dear all, I have daily data in wide-format from 01/01/1986 to 31/12/2016 by ID. I would like to convert this to weekly average data. The data has been generated by an algorithm. I know that I can use the lubridate package but that would require me to first convert the data to long-form (which is

Re: [R] How to generate a conditional dummy in R?

2018-05-29 Thread Faradj Koliev
Dear Jim, wow! It worked! Thanks a lot. I did as you suggested and it worked well with the real data. Although it gave me this error: Error in if (!is.na(x$Y[i])) { : argument is of length zero. For some reason the X1 produced less observations than it is in the data. But it's not a big