Displaying 20 results from an estimated 6000 matches similar to: "sweep and zoo objects"
2010 Aug 11
2
Sweeping a zoo series
Given a long zoo matrix, the goal is to "sweep" out a statistic from the
entire length of the
sequences.
longzoomatrix<-zoo(matrix(rnorm(720),ncol=6),as.yearmon(outer(1900,seq(0,length=120)/12,"+")))
cnames<-c(12345,23456,34567,45678,56789,67890)
colnames(longzoomatrix)<-cnames
longzoomatrix[1:24,]
12345 23456 34567 45678
2009 Dec 07
2
Filtering a zoo object based on index of another object
Hello everybody,
I have two datasets, observed and predicted.
Since my observed dataset is not in regular intervals, I need to filter my
predicted dataset based on the measurement date of my observed data.
Here, is an example similar to what I have
library(chron);library(zoo)
DATE<- seq(as.Date("2009-01-01"), as.Date("2009-05-01"), by = 1)
mydat<- rnorm(length(DATE),
2011 Sep 12
5
Hourly data with zoo
I have date data as a numeric and hourly data in 0 to 2300 hours in a dataframe.
d <- rep(20110101,24)
h <- seq(from = 0, to = 2300, by = 100)
df <- data.frame(LST_DATE = d, LST_TIME = h, data = rnorm(24, 0, 1))
S <- chron(dates. = as.character(df$LST_DATE), times. =
paste(as.character(df$LST_TIME/100), ":0:0", sep = ""),
format =
2007 Jun 29
1
sweep sanity checking?
A friend of mine just got bitten by the fact that
sweep() will happily sweep out a STATS vector
of an arbitrary length -- even one whose length
is not a divisor of any of the margins -- without
complaining. I know the answer to this could
be "well just don't do that", but it's easy to make
a mistake in which margin you're sweeping ...
What would R-core think of the
2010 Jun 14
1
recursively Merging a list a zoo objects
The zoo package as a merge function which merges a set of zoo objects
result<-merge(zoo1,zoo2,...)
Assume your zoo objects are already collected in a list
# make a phony list to illustrate the situation. ( hat tip to david W for
constructing a list in a loop)
ddat <- as.list(rep("", 20))
ytd<-seq(3,14)
for(i in 1:20) {
+ ddat[[i]] <- zoo(data,ytd )
+ }
ddat
[[1]]
1 2
2010 Aug 20
1
differecing a zoo series
A quick question
x <- as.yearmon(2000 + seq(0, 23)/12)
x
[1] "Jan 2000" "Feb 2000" "Mar 2000" "Apr 2000" "May 2000" "Jun 2000" "Jul
2000" "Aug 2000" "Sep 2000" "Oct 2000" "Nov 2000" "Dec 2000" "Jan 2001"
[14] "Feb 2001" "Mar 2001" "Apr
2009 Mar 17
2
sweep?
I am having a hard time understanding just what 'sweep' does. The documentation states:
Return an array obtained from an input array by sweeping out a summary statistic.
So what does it mean "weeping out a summary statistic"?
Thank you.
Kevin
2010 Dec 21
1
lm() on a matrix of zoo series
I have a matrix of zoo series. each series is in a column.
x <- as.yearmon(2000 + seq(0, 23)/12)
# 24 months of data, lets make 20 sets of random data
testData <- matrix(rnorm(480),ncol=20)
# make a zoo object and columns will hold the 20 series
TestZoo <- zoo(testData,order.by=x)
# now run lm for just one series.
m <- lm(TestZoo[,1]~time(TestZoo))$coeff[2]
m
time(TestZoo)
2012 Aug 04
1
how to coerce the result of sweep to be an array if result of FUN is a string?
Hi,
I would like to use sweep to "sweep out" proportions and confidence intervals for an array, however when I supply a function which returns a string (containing something like "9% (3-18%)") I get back a list instead of an array, here is a simplified example:
# example showing that sweep does not return an array with same dimensions as STATS as advertised
2004 Aug 06
1
preliminary Speex support in Sweep
Hi Jean-Marc and others,
I put Speex support in Sweep (a sound editor) yesterday, and had some
fun with it :) I'd like to get some feedback before releasing it
publically.
I'm not really used to speech codecs (I work more with music) but I've
been quite impressed at the file size and quality (especially when you
hear what I did with some of the sample files ;)
I didn't have any
2004 Aug 06
0
please test rc2 support in sweep :)
Hi,
I'm updating speex support in sweep to RC2 and I'd like some advice
on encoder options, and would appreciate some testing of the user
interface.
a screenshot of the updated speex encoding dialog:
http://www.vergenet.net/~conrad/tmp/sw_speexRC2_1.png
you can grab a tarball of sweep for testing here:
http://www.vergenet.net/~conrad/tmp/sweep-0.8.0-speexRC2.tar.gz
general
2006 Jul 12
0
Odd "sweep" error on older code
I''ve got a Rails project that has been on the shelf for a few months,
and I''m picking it back up. I''ve frozen Rails at 1.1.4 in vendor/,
and did the "rails ." and "rake rails:update" to get it up to a
current Rails level.
The code initially seems to be working fine, but when I go to my
login method, I get a 500 error thrown. Looking in the
2010 Jul 22
0
sweep / mapply question
Dear list,
I have a matrix, spc, that should row-wise be interpolated:
E.g.
spc <- matrix (1:1e6, ncol = 250, nrow = 4000, byrow = TRUE)
spc [1:10, 1:10]
shifts <- seq_len (nrow (spc))
wl <- seq_len (ncol (spc))
interpolate <- function (spc.row, shift, wl)
spline (wl + shift, spc.row, xout = wl, method = "natural")$y
interpolate (spc [1,], shift = shifts [1], wl = wl)
2010 Nov 29
2
R equivalent of Beaton's Sweep algorithm
I'm looking for an R equivalent of Beaton's (1964) Sweep algorithim for
partial inversion of a
matrix by pivoting.
It implemented in SAS/IML as sweep(matrix, indices), described here
http://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/langref_sect266.htm
and here for python
http://adorio-research.org/wordpress/?p=262
--
Michael Friendly Email: friendly AT yorku
2005 May 09
0
Sweep statistics
Dear List:
I am wondering if there is a more efficient way to compute the
following. For the example I am using the star data frame in the mlmRev
package. This has 80 schools and includes grades K, 1, 2, and 3. First I
compute the grade level mean in each school using tapply as:
tapply(star$math, list(star$sch,star$gr), mean, na.rm=T)
This results in a table of means by school for each grade.
2009 Dec 16
1
difference between the meaning of MARGIN in sweep() and apply()
For example, subtracting 1:2 from the rows of a two-column matrix:
> t(apply(matrix(1:6,ncol=2),MARGIN=1,function(y) y - 1:2))
[,1] [,2]
[1,] 0 2
[2,] 1 3
[3,] 2 4
> sweep(matrix(1:6,ncol=2),MARGIN=2,1:2,FUN="-")
[,1] [,2]
[1,] 0 2
[2,] 1 3
[3,] 2 4
Is there a logic to this difference, or is it just a quirk of the history of
these
2005 Jun 20
6
sweep() and recycling
Hi
I had a hard-to-find bug in some of my code the other day, which I
eventually
traced to my misusing of sweep().
I would expect sweep() to give
me a warning if the elements don't recycle nicely, but
X <- matrix(1:36,6,6)
sweep(X,1,1:5,"+")
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 2 9 16 23 30 32
[2,] 4 11 18 25 27 34
[3,] 6 13 20 22
2010 Nov 18
3
sweep by levels of a factor
Hi,
I'd appreciate help with this. I have a data matrix with one column, called
f in the example below, a factor. I'd like to subtract the means from each
of
other columns for each level of the factor. That is, in the example, to go
from the first matrix below to the second. I know SWEEP will take out means,
but I want to do this for each level of the factor.
f x
1 2
1
2011 Mar 17
1
Using barplot() with zoo -- names.arg not permitted?
I've used barplot(), including the anmes.arg parameter, on data frames
successfully, but I'm even newer to using zoo than I am to R. :-}
I am working on a functon that accepts a data frame ("df") as its
primary argument, extracts information from it to create a zoo, then
generates a plot based on that.
The data frame has a column called "time" which is a standard
2011 Oct 31
1
Vectorize 'eol' characters
Dear R users,
When dumping an R matrix object into a file -- typically via the 'write.table' function -- the 'eol' option can be used to specify the end-of-line character(s) which should appear at the end of each row.
However the argument to 'eol' seems to be restricted to have length 1, whereas ideally I would like different rows to be written to file each with its own