b$value - target
cusums <- cumsum(deviation)
data.frame(sub, deviation=deviation,cusums=cusums)
}
vmask(sub, 10)
Note that this makes substantial assumptions about the structure of
the sub argument, namely that it has a column named value.
Sarah
> PS: Thank you so much for he
an? And how can i fix it?
PS: Thank you so much for helping me with this.
From: Sarah Goslee
To: Pavneet Arora/UK/RoyalSun@RoyalSun
Cc: r-help
Date: 24/07/2014 15:04
Subject:Re: [R] Creating Functions in R
Hi,
On Thu, Jul 24, 2014 at 9:35 AM, Pavneet Arora
wrote:
> H
Modified your function and also you don't need a function to do this:
sub <- structure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30), value = c(9.45, 7.99, 9.29, 11.66, 12.16, 10.18, 8.04,
11.46, 9.2, 10.34, 9.03, 11.47
Before you start writing functions, you should learn the basics of R by reading
"An Introduction to R"
(http://cran.r-project.org/doc/manuals/r-release/R-intro.pdf). Pages 7 and 8
cover what you are asking. There is no need for a for() loop at all and your
function is simply overwriting the val
Hi,
On Thu, Jul 24, 2014 at 9:35 AM, Pavneet Arora
wrote:
> Hello Guys
> I am new at writing Functions in R, and as a result am struggling with it.
> I am trying to use Google & other resources, but it's hard to find
> solutions when you don't know what to look for.
How about the introduction t
5 matches
Mail list logo