similar to: Pre-allocation of matrices is LESS efficient?

Displaying 20 results from an estimated 8000 matches similar to: "Pre-allocation of matrices is LESS efficient?"

2009 Jun 01
4
Recommendations for a quick UI.
Hi. This is my first post to this list, I seem to be graduating to from the r-help list. :-) I'm trying to wrap my R package in a GUI such that when the user launches the app, they see my GUI window and never interact with the R console at all. I don't have any fancy requirements for the GUI itself-- all it needs to do is collect input from the user and pass the input as arguments to
2010 Oct 30
1
summary.lm for post-hoc tests
Let's say I've run Anova(lm(y~a*b)) and found the a:b interaction to be significant. Now I'm interested in which specific level combinations of a and b significantly differ from the control group. Can I use the t-tests from summary(lm(y~a*b)) to answer that question? I saw no mention of multiple comparison in the documentation for summary.lm, so am I right in assuming I need to
2011 Nov 29
5
Why Numeric Values Become Factors in Data Frame
I have a data frame with 1 factor, one date, and 37 numeric values: str(waterchem) 'data.frame': 3525 obs. of 39 variables: site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 ... $ sampdate : Date, format: "2007-12-12" "2008-03-15" ... $ CO3 : num 1 1 6.7 1 1 1 1 1 1 1 ... $ HCO3 : num 231 228 118 246
2008 Jun 08
2
optim, constrOptim: setting some parameters equal to each other
Hello, and apologies for the upcoming naive questions. I am a biologist who is trying to teach himself the appropriate areas of math and stats. I welcome pointers to suggested background reading just as much as I do direct answers to my question. Let's say I have a function F() that takes variables (a,b,c,a1,b1,c1) and returns x, and I want to find the values of these variables that result in
2005 May 05
2
efficient filtering of matrices
I was wondering if someone can tell me the best way to search through a matrix and choose certain rows (based on certain conditions) to put into a separate matrix. What I have tried so far is very slow for a large dataset I'm working with. e.g., I have this piece of code to create a new matrix (newmat) based on my filtering conditions. Do I need to do this kind of thing where I keep
2012 Dec 28
4
efficiently multiply different matrices in 3-d array with different vectors?
Hello, I have been wondering of an efficient way to do this: I have an n x m x p array Z and a p x n matrix Y. I want to multiply each of the n matrices with the corresponding column vector of Y. In other words, I am wanting to matrix multiply: Z[i, ,] %*% Y[, i] which will give me a (two-dimensional) array or matrix of dimension n x p with the i'th row storing the above. Any pointers
2007 Oct 09
1
Handling two lists of matrices
I'm having trouble setting up the function call to handle two lists of matrices. Each list has 6 matrices - Each matrix is 20x10. I need to do some basic math on corresponding matrices in each list. Here are some outputs of these lists, etc... # first list > length(qc.pm) [1] 6 > dim(qc.pm[[1]]) [1] 20 10 > qc.pm[[1]][1:4,1:4] 441-JP071707.CEL 442-JP071707.CEL
2012 Nov 25
1
I'd like to know more efficient method to verify the pre-packaged codes
Hello, I want to add some new functionalities in the package 'quantmod '. So I download source code and am managed to build it. I found that modifying code and check if it works by repeating the following steps: 1) r CMD check quantmod 2) r CMD build quantmod 3) r CMD INSTALL quantmod_0.3-17.tar.gz 4) launch R gui 5) library('quantmod') 6) run my script Let me know if there
2009 Feb 19
1
How to unload a dll loaded via library.dynam()?
Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works for the native R objects in the package. However, the compiled C library remains
2009 Feb 19
1
How to unload a dll loaded via library.dynam()?
Hello. To save the hassle of quitting and restarting R every time I rebuild the package I'm working on (for the purposes of this question called "roots") I would like to write a script cleanly remove the package from my R session and then load it again. Of course detach("package:roots") works for the native R objects in the package. However, the compiled C library remains
2006 Jun 27
3
looking for a more efficient R code.
Dear R-users I have four simple linear models, which are all in the form of a*X+b The estimated parameter vectors are a <- c(1,2,3,4) b <- c(4,3,2,1) My goal is to draw a plot where x-axis is X (range from -100 to 100) and y-axis is the sum of all four linear models X <- seq(-100,100, length=10000) plot(X, sum of the four linear functions) I started with a function for summing
2013 Apr 25
0
Superposición de matrices pre nlme o lmer
Hola a todos, mi consulta va relacionada con los paquete nlme o lmer. Mi idea va relacionada a correr un modelo lineal mixto en el cual una de las matrices de incidencia (Z), sea previamente formada por la suma de dos matrices o por su puperposición (Z1+Z2=Z) dentro de esas funciones. Con un ejemplo creo que me explicaré mejor outputF<-lmer(formula=ALT~ (1|MADRE)+(1|PADRE)+(1|FAMILIA),
2004 Jun 09
2
moving data and output?
Hello, I have a few questions now: 1. How can I move data the following way: I have 2 variables: one two 1 5 ^ 3 4 | 1 3 | 4 4 | Now I want to move the two one arround (sorry I don't know how to say that in english). That means: I want to move the first item at the end of my column and move the second at the first place, the third at the second, and so on. You can see it at
2009 Apr 13
2
weighted mean and by() with two index
Hi expeRts, I would like to calculate weighted mean by two factors. My code is as follows: R> tmp <- by(re$meta.sales.lkm[, c("pc", "sales")], re$meta.sales.lkm[, c("size", "yr")], function(x) weighted.mean(x[,1], x[,2])) The result is as follows: R> tmp size: micro yr: 1994 [1] 1.090
2010 Jul 21
1
tcltk resizing when using tkgrid for layout
I've been able to figure out on my own how to do what I need in the largely undocumented tcltk package, but I've finally hit a wall. I can't even think of any sufficiently specific search terms to use for this. I'm trying to make the widgets in my tk window resize when the window is resized by clicking and dragging on its corners or edges. Instead they stay exactly where they
2004 Aug 13
5
simtest for Dunnett's test
Hi! I use simtest fonction of multcomp package to compile a Dunnett's test. I have 10 treatments and one control group, so i create a matrix with: m<-matrix(0,10,11) m[1,1]<--1 m[1,2]<-1 m[2,1]<--1 m[2,3]<-1 m[3,1]<--1 m[3,4]<-1 m[4,1]<--1 m[4,5]<-1 m[5,1]<--1 m[5,6]<-1 m[6,1]<--1 m[6,7]<-1 m[7,1]<--1 m[7,8]<-1 m[8,1]<--1 m[8,9]<-1
2010 Mar 16
1
Problems compiling a simple source package on MacOS X
Hello. I wrote a package (that contains C source) that I've been compiling and running on both Linux and Windows for about a year. However, that same source package fails to compile on MacOS (10.4.11, PowerPC G4, Xcode installed, gcc version 4.0.1, make version 3.80, ld version cctools-590.23.2.obj~17). There is nothing platform-specific in the code-- just numerical functions that I
2010 Jan 27
1
How to split a matrix into a few matrices?
Hi dear users, I try to split a matrix into a few matrices, for example, suppose that I have 1000X4 matrix from mvrnorm(1000,m,c) with m<-matrix(c(0,0,0,2),4,1) and c<-matrix(c(1.0,0.2,-0.5,0.3,0.2,1,0.2,-0.5,-0.5,0.2,1,0.2,0.3,-0.5,0.2,1),4,4,byrow=T) How to split the matrix into a. 2 matrices which the first one consists of the first 500 rows, and the second one consist of the
2009 Oct 19
1
Question about IMAP IDLE (and Palm Pre)
Hello, i try to understand, how it works (IDLE). Try to get it successfully work with my new Palm Pre ;-) which looks like to have a lot issues wir imap... so i'll blame not dovecot for the issues. Sent a mail, from googlemail. processed by dovecot ad 12:11. what me now confusing, is, that there in the out-log is nothing visible, I expected, to see there was sent an notification, there was
2011 Apr 14
3
Find number of elements less than some number: Elegant/fast solution needed
Take vector x and a subset y: x=1:10 y=c(4,5,7,9) For each value in 'x', I want to know how many elements in 'y' are less than 'x'. An example would be: sapply(x,FUN=function(i) {length(which(y<i))}) [1] 0 0 0 0 1 2 2 3 3 4 But this solution is far too slow when x and y have lengths in the millions. I'm certain an elegant (and computationally efficient)