Displaying 20 results from an estimated 5000 matches similar to: "avoiding loops"
2005 Mar 22
5
Convert timeseries to transition matrix
Hi All,
Does someone have an idea of how to cleverly convert a categorical
timeseries into a transition matrix?
Ie, I have something like:
x<- c(1,1,2,1,1,2,2,2,1,2),
And I want a matrix with counts and/or probabilities:
> tr <- matrix(c(2,3,2,2),2,2)
> tr
[,1] [,2]
[1,] 2 2
[2,] 3 2
Meaning that there are two transitions from 1 to 1, two from 1 to 2, three
from 2 to 1
2006 Oct 13
3
Barplot legend position
Dear useRs,
I'm trying to create a barplot like so:
x=matrix(1:10,2,5)
barplot(x,leg=c("left","right"),besid=T)
The legend is placed in default position topright, however the data are
plotted there too. I tried controlling the legend position by adding
x="topleft" but this results in an error that x matches multiple formal
arguments.
Leaving out the legend
2004 May 12
4
bus error macosx/off-topic
Hi All,
I'm building a package using C/C++ and Fortran code which usually runs fine.
However I do get occasional bus errors around the time of exiting one of the
C functions.
Where do I need to be looking to solve this problem?
Do bus errors stem from unmapped memory exceptions? How can I find out if
that is what is happening while running R?
Any hints greatly appreciated.
Best, ingmar
2005 May 22
3
constraints
Is there a package in R that handles general linear (in-)equality + box
constrained optimization?
If it is not there, could anyone advise me which way to go?
And/or point me to packages that solve these problems partially?
best, ingmar
--
Ingmar Visser
Department of Psychology, University of Amsterdam
Roetersstraat 15, 1018 WB Amsterdam
The Netherlands
http://users.fmg.uva.nl/ivisser/
tel:
2008 Apr 07
2
tcltk issue remains
Dear R-help,
I'm trying to load the fGarch package and keep running into problems
with tcltk:
After succesfully instaling fGarch (and dependencies) I get:
>library(fGarch)
Loading required package: fBasics
Loading required package: fImport
Loading required package: fSeries
Loading required package: robustbase
Loading required package: fCalendar
Loading required package: MASS
Loading
2004 Mar 30
1
Console/command line output
Hi all,
I am working on Macos x 10.3 (Panther) to build a package consisting of
C/C++ code that is called from R. In the C/C++-sources I use several
commands to print info to the console:
std::cout << "info" << endl;
and:
Rprintf("info\n");
Both work fine when R is run on the command line but neither works when
running Raqau (I did check the preference boxes
2008 Dec 17
1
repeated measures aov with weights
Dear R-help,
I'm facing a problem with defining a repeated measures anova with
weighted data.
Here's the code to reproduce the problem:
# generate some data
seed=11
rtrep <- data.frame(rt=rnorm(100),ti=rep(1:5,20),subj=gl
(20,5,100),we=runif(100))
# model with within factor for subjects/repeated measurements, no
problem
aov(rt~ti + Error(subj/ti),data=rtrep)
#model with weights
2005 Apr 28
1
help files and vignettes
Hi all,
I'm writing a vignette for my package, and I would like to include some of
the package help files in there as well. Is there an easy way of doing so?
I tried using R CMD Rdconv to generate latex files from .Rd files but I am
not sure how to include these into a .Rnw file (ie the vignette source). The
resulting file from Rdconv do not readily compile using latex ...
The other option I
2005 Oct 31
1
information matrix in random effects model
I use the lme function from the nlme library (or alternatively from the
Matrix library) to estimate a random effects model. Both functions return
the covariance matrix of the estimated parameters. I have the following
question:
Is it possible to retrieve the information matrix of such a model (ie from
the fitted object)? In particular, the information matrix can be computed as
a sum of individual
2007 Jan 05
1
Efficient multinom probs
Dear R-helpers,
I need to compute probabilties of multinomial observations, eg by doing the
following:
y=sample(1:3,15,1)
prob=matrix(runif(45),15)
prob=prob/rowSums(prob)
diag(prob[,y])
However, my question is whether this is the most efficient way to do this.
In the call prob[,y] a whole matrix is computed which seems a bit of a
waste.
Is there maybe a vectorized version of dmultinom which
2005 Dec 01
2
suppress checking chm files in R CMD check on Windows
Dear R-helpers,
When installing a source package I can suppress the compilation of .chm
files by using the --docs="normal" option. Is it also possible to suppress
the creation and checking of .chm files when calling R CMD check ?
best, ingmar
2005 May 03
1
Rd.sty error
I had written a vignette and included a
\usepackage{Rd} command to make it possible to include
latex'ed Rd files in the vignette. However, when loading
Rd.sty texShop produces the following error:
l. 180 ...d}[1]{\ifmmode\bm{#1}\else\textbf{#1}\fi}
This is on Max OS X 3.9 and R 2.0.1
Has anyone seen this before and/or is it problematic? I'm not sure whether
the output suffers from this
2006 Mar 23
2
invalid variable type in model.frame within a function
Dear expeRts,
I came across the following error in using model.frame:
# make a data.frame
jet=data.frame(y=rnorm(10),x1=rnorm(10),x2=rnorm(10),rvar=rnorm(10))
# spec of formula
mf1=y~x1+x2
# make the model.frame
mf=model.frame(formula=mf1,data=jet,weights=rvar)
Which gives the desired output:
> mf
y x1 x2 (weights)
1 0.8041254 0.1815366 0.4999551 1.4957814
2
2011 Feb 11
2
fitdistr question
Hello,
I tried to fit a poisson distribution but looking at the function
fitdistr() it does not optimize lambda but simply estimates the mean
of the data and returns it as lambda. I'm a bit confused because I was
expecting an optimization of this parameter to gain a good fit...
If I would use mle() of stats4 package or mle2() of bbmle package, I
would have to write the function by myself
2005 Dec 01
1
contrib pkg install problem on Windows with R2.2.0
Dear R-helpers,
I made the package depmix for fitting hidden markov models.
After updating R to version 2.2.0 on my PC I got the following error when
installing the package from a local directory. One of the C files includes
the R.h file which apparently causes problems.
I call
R CMD INSTALL --docs="normal" depmix
and I get the following error:
make[3]: *** No rule to make target
2009 Mar 12
2
Time-Ordered Clustering
Hello All,
Does anyone know of a package that performs constraint-based clusters?
Ideally the package could perform "Time-Ordered Clustering", a technique
applied in a recent journal article by Runger, Nelson, Harnish (using MS
Excel). Quote, "in our specific implementation of constrained
clustering, the clustering algorithm remains agglomerative and
hierarchical, but observations
2005 Jan 26
1
error in building help files
Hi All,
I was updating my help pages for a package when all of a sudden I got the
following error when using R CMD INSTALL:
>>> Building/Updating help pages for package 'depmix'
Formats: text html latex example
Error in load(zfile, envir = envir) : error reading from connection
Removing all the help files makes the error disappear, but only removing the
help file that I
2004 Jul 05
1
passing char's from C to Fortran (mac os x)
Hello All,
In some package I use a c-routine which calls a fortran routine which
expects a char-string as input.
As per the writing R-extensions manual,
the Fortran routine is declared in C as:
void F77_NAME (setoptions) (char **option);
and then it is calles as follows:
char **option;
option = new char*[1];
option[0] = new char[256];
option[0] = strcpy(option[0],"Iteration
2008 Mar 08
1
R cmd check error reg namespace
Hi,
When running R CMD check I'm getting a number of errors that I don't
quite follow and don't know where to start looking for an answer, any
hints appreciated.
R CMD check trunk
* checking for working latex ... OK
* using log directory '/Users/ivisser/Documents/projects/
depmixProject/depmixNew/rforge/depmix/trunk.Rcheck'
* using R version 2.6.2 (2008-02-08)
* checking
2006 Feb 28
3
any more direct-search optimization method in R
Hello list,
I am dealing with a noisy function (gradient,hessian not available) with
simple boundary constraints (x_i>0). I've tried constrOptim() using nelder
mead to minimize it but it is way too slow and the returned results are not
satisfying. simulated annealing is so hard to tune and it always crashes R
program in my case. I wonder if there are any packages or functions can do