Displaying 20 results from an estimated 1000 matches similar to: "Shafer's MIX: Query on code"
2008 Aug 18
2
matrix row product and cumulative product
I spent a lot of time searching and came up empty handed on the
following query. Is there an equivalent to rowSums that does product or
cumulative product and avoids use of apply or looping? I found a rowProd
in a package but it was a convenience function for apply. As part of a
likelihood calculation called from optim, I?m computing products and
cumulative products of rows of matrices with
2011 Nov 27
1
generating a vector of y_t = \sum_{i = 1}^t (alpha^i * x_{t - i + 1})
Dear R-help,
I have been trying really hard to generate the following vector given
the data (x) and parameter (alpha) efficiently.
Let y be the output list, the aim is to produce the the following
vector(y) with at least half the time used by the loop example below.
y[1] = alpha * x[1]
y[2] = alpha^2 * x[1] + alpha * x[2]
y[3] = alpha^3 * x[1] + alpha^2 * x[2] + alpha * x[3]
.....
below are
2003 Mar 22
1
cumprod doesn't work with data frames (PR#2667)
Full_Name: J. Sisk
Version: 1.6.1
OS: Linux (RedHat 8)
Submission from: (NULL) (67.119.41.66)
Suppose you make a data-frame like so:
xxx <- data.frame(a=10,b=20,c=30,d=40)
Then
cumprod(xxx[1,])
returns
> cumprod(xxx[1,])
a b c d
1 10 20 30 40
The documentation for cumprod says that it should work on "numerical objects",
and this is a data-frame, but it
2009 Sep 16
2
Generalized cumsum?
Is there anything like cumsum and cumprod but which allows you to
apply an arbitrary function instead of sum and product? In other words,
I want a function cumfunc(x, f) that returns a vector, so that for all n
up to the length of x
cumapply(x,f)[n] = f(x[1:n])
This would give cumsum and cumprod as special cases when f=sum or
f=prod.
I could write such a function, but I can't see
2011 Jan 27
1
How do I fix this ?
Just when I think I'm starting to learn ....
Statement z1 works, statement z doesn't. Why doesn't z work and what do I do
to fix it ? Clearly the problem is with the first NA, but I would think it's
handled through the loop vectorization.
y1 <- rnorm(20, 0, .013)
y1
[1] -0.0068630836 -0.0101106230 -0.0169663344 -0.0066314769 0.0075063818
[6] -0.0033548024 0.0015647863
2005 Sep 30
3
LDAP PDC question
When setting up an LDAP PDC do I have to have both user and machines
in the ou=People container? Here's what I've got.
LDAP Tree
ou=People,o=umd.umich.edu
ou=NIS,ou=Groups,o=umd.umich.eud
ou=machines,ou=Samba,ou=Services,o=umd.umich.edu
ou=Idmap,ou=Samba,ou=Services,o=umd.umich.edu
smb.conf (ldap stuff)
ldap delete dn = no
ldap suffix = o=umd.umich.edu
ldap
2009 Jul 31
1
what meaning missing value True /False needed
This is my code i don't understand the error message:
library(rgenoud)
rm(list=ls())
set.seed(666)
#########################################################
# As a first step, it is assumed that all input parameters are independent of ageingĀ :
#########################################################
InputDim <-20
# Max number of ageings in the inputs
CPIRate <- rep(0.02 , InputDim )
#
2006 Nov 28
2
Aligning aerial photographs and maps
I have read in Paul Murrell's book R Graphics about how to use a bitmap
as background for a plot (page 107). Also, I routinely use function
read.shape() in package maptools to read maps in shapefile format. Now,
I would like to overlay an aerial photograph in .jpg format and a map. I
think I could do the alignment manually for each case, but wonder if
there is a better, automated way. I notice
2010 Jul 09
3
apply is slower than for loop?
I thought the "apply" functions are faster than for loops, but my most
recent test shows that apply actually takes a significantly longer than a
for loop. Am I missing something?
It doesn't matter much if I do column wise calculations rather than row wise
## Example of how apply is SLOWER than for loop:
#rm(list=ls())
## DEFINE VARIABLES
mu=0.05 ; sigma=0.20 ; dt=.25 ; T=50 ;
2002 Jan 28
4
Multivariate response trees
I would like to know if someone has done work on trees with
multivariate response. I need something like rpart but for vector
responses. If someone has code that he/she is willing to share, I
would be grateful. If not, even guidelines for writing my own starting
from rpart would be welcomed.
ft.
--
Fernando TUSELL e-mail:
Departamento de
2004 Aug 06
2
multiple shout streams
I'm running multiple instances of ices. Also, I found what the problem
was with the constant stream. I was getting a default stream because I
was using my local ip address to run the server, and when I tried to
access the different streams from my outside ip address something got
confused. I'm running it from my outside ip address and everything works
fine. Does anyone know a what to run
2004 Aug 06
1
multiple shout streams
My OS in linux.
my local ip address is 192.168.1.1 I'm currently running icecast from my
comcast ip address 68.50.209.120. But if I try to connect to the stream
via 192.168.1.1 I get
404 Entity Not Found
The requested file or stream was not found on this server.
Thanks,
Aaron
<p>On Fri, 2002-09-13 at 17:14, zeek wrote:
>
> What OS is the system? What is the IPaddr?
>
>
2003 Sep 20
3
conditional function definition?
Hi Folks,
What is the best way to avoid a function being read in
anew (and masking an exiting function) when a definition
of it has already been established in R?
Reason: Fernando Tusell and I are working up Schafer's 'CAT'
for R (basically done now, just needs some cosmetic tidying up).
This uses a function 'slice.index', present in S but not in
the versions of R we were
2004 Mar 31
2
Failure to compile source packages in Debian
As of quite recently I experience failures to compile source packages.
Messages like
* Installing *source* package 'dse1' ...
** libs
g77 -mieee-fp -fPIC -g -O2 -c dsefor.f -o dsefor.o
gcc -shared -o dse1.so dsefor.o -L/usr/lib/gcc-lib/i486-linux/3.3.3
-L/usr/lib/gcc-lib/i486-linux/3.3.3/../../..
-lfrtbegin -lg2c-pic -lm -lgcc_s -L/usr/lib/R/bin -lR
/usr/bin/ld: no se puede
2005 Jan 18
1
"Attach" for S4 objects?
When passing a list as an argument to a function, I find it convenient
to attach it in the first line of th function code, then refer to the
components as A, B, etc. rather than as list$A, list$B, etc.
If I pass a S4 class object, is there a way to "attach" it, or do I have
to refer to the slots as object at A, objetc at B, etc.?
I could always make copies,
A <- object at A
2002 Feb 01
1
Sampling from a database
I use RODBC and RpgSQL quite a lot to access files stored in another
machine under PostgreSQL. Since I am now using files which do not fit
into R's memory, I would like to take random samples. What I would
like is to issue a query such as
SELECT * FROM file WHERE runif > 0.9
with "runif" being a uniformly distributed random number, generated on
the fly; but I cannot
2000 Apr 28
2
Dumping functions to RCS
To keep track of an ongoing programming project, I would like to dump
all my functions to individual ASCII files named xxx.R, yyy.R, etc.
Presently I do so manually in order to use RCS (on a Linux machine),
so I can keep track of all versions, differences, snapshots, etc.
Is there any easy way to dump all functions in the workspace to
individually named files? Thank you very much for
2012 May 25
1
Filling NA with cumprod?
Hello,
I need to build certain interpolation logic using R. Unfortunately, I just
started using R, and I'm not familiar with lots of advanced or just
convenient features of the language to make this simpler. So I struggled
for few days and pretty much reduced the whole exercise to the following
problem, which I cannot resolve:
Assume we have a vector of some values with NA:
a <- c(1,
2004 Aug 06
2
multiple shout streams
Hi,
I'm trying to figure out how to have mulitple shout streams running on
my icecast server. I'd like to have it setup like
http://192.168.1.1:8000/classical plays classical
http://192.168.1.1:8000/pop plays pop
etc.
Thanks,
Aaron
--
palott@math.umd.edu
http://www.math.umd.edu/~palott
LCV: IPST 4364A (301)405-4865
Office: IPST 4364D (301)405-4843
Fax: (301)314-0827
P. Aaron
2007 Aug 23
1
MemoriesOnWeb and wine
In http://www.edsupport.cc/mguhlin/archives/2007/08/entry_3550.htm,
Miguel Guhlin asked how to install MemoriesOnWeb and its recommended
codecs under Wine, so here goes. All I did was translate his instructions
to wine-ese.
1. Download xvid for windows from http://www.xvid.org/Downloads.15.0.html,
install it the obvious way:
$ wine XviD-1.1.3-28062007.exe
2. Download lame from