Displaying 20 results from an estimated 3000 matches similar to: "Parameterising apply To Compute Rolling Average of Columns in a matrix"
2010 Nov 16
2
Computing Rolling Average
Hi,
Can anyone suggest a clever way to compute a rolling weekly average of the
columns in a matrix? The column bit is straightforward – use apply given a
function which does what you want on a column. With regard to a particular
column, the obvious way is to run a for loop indexing the last 7 days and
computing the average . I simply would like to know if there is a better /
quicker way.
2010 Dec 31
4
Repeated Indexing / Sequence Operation
Hi Everyone,
quick question before the end of the year.
I have soem indices to select data from a bigger sample. I want to select n
days before each index and n days after the index. Any clever way to do it.
A for loop would do but I wanted to know if there is a moreR-friendly way to
approach this
Example
# InitialIndices
i2 = (90, 190, 290)
# Indices I want to end up with
i3 = c(85, 86, 87,
2010 Dec 20
2
Sine Regression in R
Hi everyone,
I am trying to fit a sine function on one year of wind data. I have two
questions below.
Looking around on the net I managed to get the following:
Sine Equation: y = a + b * sin( c + d*x )
b is the amplitude, c is the phase shift, d is something deal with
periodicty of data*.*
This can be linearised by sin( c+dx ) = cos(c) * sin(dx) + sin(c) *
cos(dx).
If one calls dx = x1
y
2011 May 19
1
Converting Variable Name into String
Hello,
I would like to create lagged and delta variables from a set of variables
and then add them to a dataframe
Suppose that GDPPcSa is a variable. I would like to be able to do this
QuarterlyData$D1GdpPcSa = diff(GDPPcSa , 1)
in an automated fashion so that I loop over Quartely data to compute the
first difference of its variables and add them to the dataframe.
.It would be great to get a
2011 Jun 15
3
Column of numbers added to dataframe when saving with read.csv
I have a dataframe object having the following structure
FinalOutput[1:3,]
GasDays 2011-03-31 2010-09-30 2010-10-31 2010-11-30 2010-12-31
2011-01-31 2011-02-28
1 2006-10-01 217303553 221205033 222824639 217016511 216093460
216477468 216834021
2 2006-10-02 231158527 234565250 236004109 231467851 230100639
230079907 230734064
3 2006-10-03 282062314 285427832 286372163
2011 Jul 08
2
Vertical Labels in plot graph - normally working fine but not on this graph
Hello,
I wonder if someone can elaborate on why in the first graph I am able to set
labels vertical to the x-axis but not in the second.
I tried to select the window but it didnt really help.
Many Thanks
Paolo
ExtAvgCWV = rnorm(200)
ExtAvgDemand = rnorm(200)
ExtGasDays = seq(from = as.Date("2010-8-4", "%Y-%m-%d"), along.with =
ExtAvgCWV, by = "days")
2012 Jan 10
2
How to make this for() loop memory efficient?
##I have 2 columns of data. The first column is unique "event IDs" that
represent a phone call made to a customer.
###So, if you see 3 entries together in the first column like follows:
matrix(c("call1a","call1a","call1a") )
##then this means that this particular phone call (the first call that's
logged in the data set) was transferred
##between 3
2008 Jun 12
2
arima() bug
I guess this is more r-devel than r-help.
Note, I am just the messenger - I have no idea what the user is trying to model here.
arima() crashes R (segfault) with Linux R-2.7.0, Solaris R-2.6.0:
*** caught segfault ***
address 42400000, cause 'memory not mapped'
Traceback:
1: .Call(R_getQ0, phi, theta)
2: makeARIMA(trarma[[1]], trarma[[2]], Delta, kappa)
3: arima(x, c(1, 0, 1), c(1,
2011 Jul 06
1
Group Data indexed by n Variables
Hello,
the more general thing I'd like to learn here is how to compute Function of
Data on the basis of grouping determiend by n variables.
In terms of the reason why I am interested in this, I need to compute the
average of my data based on the value of the month and day across years. I
have come up withy the code below which, as far as I can see, does what I
need but getting either a more
1999 Nov 03
3
bug in Rdconvlib.pl converting to latex (PR#311)
If .../<pkg>/man/ contains a filename beginning with [, such as
[.datetimes, Rdconvlib.pl cannot convert that help file into latex at
INSTALL time. [Using --no-latex is a workaround.]
The error given is:
# R INSTALL ssCatalogues
:
help
>>> Building/Updating help pages for package `ssCatalogues'
Formats: text html latex example
/^[.datetimes$/: unmatched [] in regexp at
2008 Jun 15
1
c.noquote() weirdness
I haven't been able to get anywhere tracking this down. It seems that c.noquote() does
something strange with its third (and subsequent) parameters:
R-2.7.0 under NetBSD, R-2.6.0 under Solaris, and R-2.8.0 (unstable) (2008-06-10 r45893)
under WinXP, I get:
> c(noquote('z'), 'y', 'x', '*')
[1] z y x * x *
>
or:
> c(noquote('z'),
2002 Nov 27
1
dump() bug?
Is this a bug? Certainly it was not expected. dump() seems to prefer a
global definition over a local one. R 1.6.1 on Solaris 8 or NetBSD:
> ls()
character(0)
> dump("D", "D.q") # a global D() exists
> system("cat D.q")
"D" <-
function (expr, name)
.Internal(D(expr, name))
> D <- function(x) print(x) # now create a local one
> ls()
2001 Dec 03
1
New package: g.data
A new package "g.data" is available on CRAN, to create and maintain databases
that work more like the S-Plus model.
Here's the official Description for g.data (v1.2):
Create and maintain delayed-data packages (DDP's). Data stored in
a DDP are available on demand, but do not take up memory until requested.
You attach a DDP with g.data.attach(), then read from it and assign
2001 Dec 03
1
New package: g.data
A new package "g.data" is available on CRAN, to create and maintain databases
that work more like the S-Plus model.
Here's the official Description for g.data (v1.2):
Create and maintain delayed-data packages (DDP's). Data stored in
a DDP are available on demand, but do not take up memory until requested.
You attach a DDP with g.data.attach(), then read from it and assign
1999 Nov 05
2
library maps for R
Anybody interested in the S maps library for R? I have ported a
limited version of the software for a Unix platform, and would be happy
to make it available for anybody interested. If there is a lot of
interest then I will submit it to CRAN. I know that Ross Ihaka is
working on a new version for R, which does not have some of the
limitations of the original S version.
My version does not do
2000 Feb 16
2
contour() labels (PR#441)
R-0.99.0a now plots contour labels from contour(), but the values in
levels seem to be coerced to integer.
Reproduce by:
> set.seed(2)
> contour(matrix(runif(36),nrow=6), labcex=1.2)
and compare with:
> set.seed(2)
> contour(matrix(10*runif(36),nrow=6), labcex=1.2)
Ray Brownrigg
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list --
2002 Sep 16
1
Running Median and Mean
R gurus,
On Aug 20, 2002, I asked in R-help about calculating a running 5-day median on
a large matrix. Thanks to Martin Maechler <maechler@stat.math.ethz.ch> and Ray
Brownrigg <Ray.Brownrigg@mcs.vuw.ac.nz> for responding.
I ended up writing C code (and an R interface) to do it, which is about 1000x
faster than the naive method! (72s became .09s on a 223 x 520 matrix). I
added a
2000 Mar 16
2
R-1.0.0 on alpha/osf1 memory glitch (PR#490)
Digital Alpha (various), Digital UNIX V4.0[EF], R-1.0.0, gcc, f77
When using batch mode with the save option, an error message is issued.
However [I have just discovered that] it appears that the operation
does complete, i.e. the .RData file is saved successfully. The main
problem is that the return code is non-zero (and so it is impossible to
distinguish this "non-error" from some
2008 Aug 19
1
RNGkind() state (PR#12567)
I sent this to R-devel early last month, but have received no response, so I guess it
really is a bug.
This looks like a bug to me, and is a bit hard to describe, but easy to reproduce. ?
Basically, if RNGkind is saved as something other than the default, and if the first
operation in a session is a set.seed(), the default is reverted to. ?Reproduce by:
cafe-rozo> ?R --vanilla
R version
2009 Oct 28
3
Reading data
Hi User's,
This might be a simple question but it is giving me a hard time as I am a
new user.
I installed R version 2.9.2 (2009-08-24)
1. I just copied a short script from Fox (2002) as a practice and wanted
to save it as Rossi.R.
The system saved it without complain but when I looked at using a windows
explorer it is not *.R file but only Rossi. Why this is happening?
2. the script