Displaying 20 results from an estimated 3000 matches similar to: "vectorized nested loop: apply a function that takes two rows"
2007 Jan 23
3
[fixed] vectorized nested loop: apply a function that takes two rows
(Extremely sorry, disregard previous email as I hit send before pasting the latest version of the example; this one is smaller too)
Dear R users,
I want to apply a function that takes two vectors as input to all pairs
(combinations (nrow(X), 2))of matrix rows in a matrix.
I know that ideally, one should avoid loops in R, but after reading the docs for
do.call, apply, etc, I still don't know
2007 Jan 23
3
[fixed] vectorized nested loop: apply a function that takes two rows
(Extremely sorry, disregard previous email as I hit send before pasting the latest version of the example; this one is smaller too)
Dear R users,
I want to apply a function that takes two vectors as input to all pairs
(combinations (nrow(X), 2))of matrix rows in a matrix.
I know that ideally, one should avoid loops in R, but after reading the docs for
do.call, apply, etc, I still don't know
2007 Jan 26
2
%*% in Matrix objects
Dear R users,
I need to normalize a bunch of row vectors. At a certain point I need to divide a matrix by a vector of norms. I find that the behavior of Matrix objects differs from normal matrix objects. Example the following code examples differ only in xnormed changing from normal to Matrix object:
x = matrix(1:12,3,4)
x = as(x, "CsparseMatrix")
xnorms = sqrt(colSums(x^2))
2006 Apr 16
0
R-vim suite
Hi All,
If you use vim to edit R code, you may be interested in this.
I have put together a personalized syntax file, some code templates,
and a way to send code from Vim to R using autoHotKeys (windows).
http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
Actually, the little autoHotKeys can be useful even if you don't use
vim just to send the example R code from the help
2006 Apr 27
3
gmane?
Hi All,
I recently found gmane
http://gmane.org/
It's a system to covert mail to news and back, with the nice property of
keeping
a searchable archive... Very convenient if you are subscribed to many lists
and
don't want to have your mail box cluttered. I use it to read several mailing
lists already, but R is not available there.
I wonder if the admins know about gmane and if they
2007 Jun 19
1
Matrix library error: "should never happen; please report"
Hi,
I got the following error. Sorry but this time I couldn't reproduce it
with a simple chunk of code:
.TM.repl.i.2col(): drop 'matrix' case ...
Error in .nextMethod(x = x, i = i, j = j) :
'i' has no integer column number should never happen; please report
In addition: Warning messages:
1: Ambiguous method selection for "%*%", target
2007 Apr 16
1
colSum() in Matrix objects
Hi,
I'd like to simply add column-wise using Matrix objects (Csparse).
It looks like one can apply mosty any base function to these objects
(i.e., apply, colSums), but there is a nasty conversion to traditional
matrix objects if one does that.
Is there any workaround? I can see colSum listed in the help for Class
'CsparseMatrix' , but I wonder whether I'm using the default
2007 May 15
1
Matrix package: writeMM
Hi,
I'm finding that readMM() cannot read a file written with writeMM().
Example:
library(Matrix)
a = Matrix(c(1,0,3,0,0,5), 10, 10)
a = as(a, "CsparseMatrix")
writeMM(a, "kk.mm")
b = readMM("kk.mm")
Error in validObject(.Object) : invalid class "dgTMatrix" object: all row
indices must be between 0 and nrow-1
Thoughts?
Thanks,
-Jose
--
Jose
2006 Apr 18
6
R and ViM
Dear all,
I'm starting to learn R, but I'm already programing for a while, using
ViM as editor. Therefore I'd like to be able to use R together with
ViM.
My question now is, whether there are already people out there knowing
how to do this in a similar easy way as with Emacs, and if those would
be willing to share this knowledge.
I did already research on the web on this topic,
2007 May 07
3
like apply(x,1,sum), but using multiplication?
Hi,
I need to multiply all columns in a matrix so something like
apply(x,2,sum), but using multiplication should do.
I have tried apply(x,2,"*")
I know this must be trivial, but I get:
Error in FUN(newX[, i], ...) : invalid unary operator
The help for apply states that unary operators must be quoted. I tried
single quotes too, with the same results.
Thanks,
-Jose
--
Jose
2017 Jul 11
0
Multivariate random forests in R - how to obtain variance explained for multiple responses in randomForestSRC package - or other package
Hello,
I am wanting to use MRF to do multivariate regression.
We are testing whether acoustic indices can predict structure (relative abundances) of vocalising avian community in UK and Ecuador.
There are 26 acoustic indices, 65 UK species and 95 Ecuadorian species.
I want to build a model for each ecozone (UK/ EC) using all species (relative abundance) as response matrix, and acoustic indices as
2008 Dec 06
1
R vs Python performance-wise
Hi,
Has anyone run any R vs Python (numpy) tests?
I'd love to see what the differences performance-wise are, specially
handling large sparse matrices.
Since both rely on external C code, there might not be much of a
difference.
If you know and use both languages, what are the main differences and what
made you stick to one over another?
I also noticed that there are strong libraries
2009 Oct 24
1
operations on sparse matrices, and dense intermediary steps
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm doing some basic operations on large sparse matrices, for example
getting a row.
it takes close to 30 seconds on a 3Ghz machine, and shots the memory
usage up to the sky.
I suspect there are dense intermediary steps (which, if true would
defeat the purpose of trying to use sparse representaitons).
As much as I try understanding the
2008 Sep 11
0
Error: bad value
Dear R Users,
I am getting a strange error, also relayed by Jose Quesada about a year
ago. As below, in his message, I get "Error: bad value" to whatever I
enter into the R console.
My configuration is:
- Windows XP SP2
- R 2.7.2
Has this problem been tracked down to a specific package ? I am using the
following packages:
library(strucchange)
library(car)
library(lmtest)
2007 Jul 16
1
R equivalent to Matlab's Bayes net toolbox
Hi,
I'm attending summer School at UCLA (IPAM) on "probabilistics models of
cognition". I have been an R-user since v. 1.4.1, but was trained in the
frequentist tradition (as most psychologists!). I found that all faculty
here use matlab and Murphy's bayes net toolbox. I have not had the need to
use matlab before, and would love to stick to R for graphics models and
2007 Jun 22
1
Matrix library, CHOLMOD error: problem too large
I have a pretty large sparse matrix of integers:
> dim(tasa)
[1] 91650 37651
I need to add one to it in order to take logs, but I'm getting the
following error:
> tasa = log(tasa + 1)
CHOLMOD error: problem too large
Error in asMethod(object) : Cholmod error `problem too large'
I have 2 Gb of RAM, and the current workspace is barely 300mb.
Is there any workaround to this?
2007 Jun 22
1
Matrix library, CHOLMOD error: problem too large
I have a pretty large sparse matrix of integers:
> dim(tasa)
[1] 91650 37651
I need to add one to it in order to take logs, but I'm getting the
following error:
> tasa = log(tasa + 1)
CHOLMOD error: problem too large
Error in asMethod(object) : Cholmod error `problem too large'
I have 2 Gb of RAM, and the current workspace is barely 300mb.
Is there any workaround to this?
2007 Jun 14
1
Error: bad value ? what is that?
Hi,
I'm finding a very strange error.
For no good reason my R console (Rgui.exe, R 2.5.0, under win XP) stops
producing anything meaningful, and just returns:
Error: bad value
to _whatever_ I enter. It starts doing this after a while, not immediately
when launched.
I have to restart R when this happens.
No idea why. I didn't change anything in the R config that I remenber.
Any
2002 Jan 25
1
Fw: Summary for Distance matrix by cosine?
Dear all,
below you find enclosed my message from January 9th and my program
(attention: beginner).
Thanks for both answers! a. However, as far as I know the cosine is not the
same as the Pearson correlation (only in special cases).
b. Reid Huntsinger's hint was very useful, however I had to transpose the
matrix first, for I want to calculate the distance of the _rows_.
Regards,
Petra
2007 Dec 19
1
Correlation when one variable has zero variance (polychoric?)
Hi,
I'm running this for a simulation study, so many combinations of parameter
produce many predictions that I need to correlate with data.
The problem
----------------
I'm using rating data with 3 to 5 categories (e.g., too low, correct, too
high). The underlying continuous scales should be normal, so I chose the
polychoric correlation. I'm using library(polychor) in its