Re: [R] How to calculate Rolling mean for a List object

2017-05-14 Thread Gabor Grothendieck
Try this code which does not use rollapply: w <- 3 Mean <- function(L) Reduce("+", L) / length(L) lapply(w:length(Data), function(i) Mean(Data[seq(to = i, length = w)])) On Sun, May 14, 2017 at 6:44 PM, Christofer Bogaso wrote: > Hi again, > > I am looking to find a

[R] How to calculate Rolling mean for a List object

2017-05-14 Thread Christofer Bogaso
Hi again, I am looking to find a way on how to calculate Rolling average for the elements of a list. For example consider below object 'Data'. This is a list, where each elements are a Matrix. Basically, I am trying to get Rolling average of those Matrices with rolling window as 5. Data =

Re: [R] Fwd: Cannot generate a *.docx file

2017-05-14 Thread Robert Baer
I don't know what the error is, but your code snippet worked fine for me on Windows 10, R 3.4.0-patched. I noticed that rJava is a dependency. Don't know that the patch or Java updates I installed today could be a difference, but you might update packages, patched version, Java, etc and

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread Robert Baer
I got this but the spacing is all wrong and plotmath() seems to have no way to do kernning or overprinting. I'm surprised Paul didn't generalize the hat()-type functionality. ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) + xlab(expression(atop("\U0308",Omega))) ggplot(data,

Re: [R] Fwd: Cannot generate a *.docx file

2017-05-14 Thread Bert Gunter
Sorry, no clue. If you don't get a satisfactory reply here, you should contact the maintainer, David Gohel . Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread Ranjan Maitra
On Sun, 14 May 2017 09:08:46 -0700 David Winsemius wrote: > > > On May 14, 2017, at 8:43 AM, Ranjan Maitra wrote: > > > > Thanks, Duncan! > > > > This works for the particular case and is, to my mind, a great solution! > > > > However, I was

[R] Fwd: Cannot generate a *.docx file

2017-05-14 Thread Yves S. Garret
I'm using R 3.4.0. -- Forwarded message -- From: Yves S. Garret Date: Sun, May 14, 2017 at 2:35 PM Subject: Cannot generate a *.docx file To: r-help Hello, I have the following code example: library(ReporteRs) # Create a

Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend

2017-05-14 Thread David Winsemius
> On May 14, 2017, at 11:43 AM, Tobias Christoph > wrote: > > Hey Peter, > > it is not necessary to use "factor(town)". I can just use "town" as the name > of the towns is already numeric. > Isn't it a discrete variable? You most probably do want a different

Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend

2017-05-14 Thread Tobias Christoph
Hey Peter, it is not necessary to use "factor(town)". I can just use "town" as the name of the towns is already numeric. Am 14.05.2017 um 20:24 schrieb peter dalgaard: On 14 May 2017, at 10:22 , Tobias Christoph wrote: Hey David, when I used your suggested

[R] Cannot generate a *.docx file

2017-05-14 Thread Yves S. Garret
Hello, I have the following code example: library(ReporteRs) # Create a word document to contain R outputs doc <- docx() # Add a title to the document doc <- addTitle(doc, "Simple Word document", level = 1) # Add a paragraph of text into the Word document cat("Output 1\n") doc <-

Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend

2017-05-14 Thread peter dalgaard
> On 14 May 2017, at 10:22 , Tobias Christoph wrote: > > Hey David, > > when I used your suggested formula: plm( log(revenue) ~ log(supply) + > factor(town) + as.numeric(as.character(year)), data=R_Test_log_Neu) I will > get the same results as without considering

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread David Winsemius
> On May 14, 2017, at 10:43 AM, David Winsemius wrote: > > >> On May 14, 2017, at 9:08 AM, David Winsemius wrote: >> >>> >>> On May 14, 2017, at 8:43 AM, Ranjan Maitra wrote: >>> >>> Thanks, Duncan! >>> >>> This works for

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread David Winsemius
> On May 14, 2017, at 9:08 AM, David Winsemius wrote: > >> >> On May 14, 2017, at 8:43 AM, Ranjan Maitra wrote: >> >> Thanks, Duncan! >> >> This works for the particular case and is, to my mind, a great solution! >> >> However, I was wondering: is

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread David Winsemius
> On May 14, 2017, at 8:43 AM, Ranjan Maitra wrote: > > Thanks, Duncan! > > This works for the particular case and is, to my mind, a great solution! > > However, I was wondering: is it possible to use these double dots with > another character, such as omega? > > I

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread Ranjan Maitra
Thanks, Duncan! This works for the particular case and is, to my mind, a great solution! However, I was wondering: is it possible to use these double dots with another character, such as omega? I apologize for changing the question somewhat, but I did not realize earlier that there were

Re: [R] Joining tables with different order and matched values

2017-05-14 Thread jim holtman
Here is a solution to the "shared values" question > library(stringr) > input <- read.table(text = "A B + + 1,2,5 3,8,7 + + 2,4,6 7,6,3 ", + header = TRUE, + as.is = TRUE + ) > > input$'shared values' <- apply(input, 1, function(x){ +

Re: [R] display double dot over character in plotmath?

2017-05-14 Thread Duncan Mackay
Hi I just had to do something similar in windows with \"{u}. Try Unicode symbol - see ?plotmath ggplot(data, aes(x=X)) + geom_line(aes(y = Z), size=0.43) + xlab(expression(atop(top,bold(Age~"\u00e4" Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New

Re: [R] Error: invalid type (closure) for the variable 'time' - object specific trend

2017-05-14 Thread Tobias Christoph
Hey David, when I used your suggested formula: *plm( log(revenue) ~ log(supply) + factor(town) + as.numeric(as.character(year)), data=R_Test_log_Neu) *I will get the same results as without considering town and year in the formula. So this might not the clue for taking into account a linear