similar to: Using vectorization instead of for loop for performing a calculation efficiently

Displaying 20 results from an estimated 2000 matches similar to: "Using vectorization instead of for loop for performing a calculation efficiently"

2004 Jul 01
2
how to drop rows from a data.frame
here is a snippet of data where I would like to drop all rows that have zeros across them, and keep the rest of the rows while maintaining the row names (1,2,3, ...10). The idea here is that a row of zeros is an indication that the row must be dropped. There will never be the case where there is a row(of n columns) with less than 5 zeros in this case(n zeros I am unsure how to manipulate the
2004 Aug 05
1
R interface to Python (in Windows)
I put a copy of R 1.8.1 for Windows on our FTP site at: ftp://ftp.odot.state.or.us/outgoing/Test/. It should be there for a few days before it gets deleted. Benjamin Stabler Transportation Planning Analysis Unit Oregon Department of Transportation 555 13th Street NE, Suite 2 Salem, OR 97301 Ph: 503-986-4104 -----Original Message----- From: Peter Wilkinson [mailto:pwilkinson at videotron.ca]
2003 Apr 02
1
Can boot return matrix?
Dear All, I have a function which takes a n x m matrix as an argument and returns an n x n matrix. I want to take bootstrap samples form the input matrix in the way as each row represent a multivariate observation, so each bootstrap sample would be an n x m matrix, and on each sample I want to calculate the n x n matrix. This task can be done with the sample function, but I would like to use
2001 May 19
2
calculations on diagonals of a matrix
Given an nxm matrix A I want to compute the nxm matrix B whose ij-th element is the sum of the elements of A lying on the diagonal that ends with element ij, i.e., b_ij = a_ij + a_(i-1)(j-1) + a_(i-2)(j-2) + ... In APL (which I no longer use), I would use the 'rotate' operator to derive an array whose columns are diagonals of the given array and then cumulate down columns. Is
2008 Sep 17
1
Exact test in nxm contingency table
Hello, I am trying to find a permutation test that works on a general nxm table. The data set is small enough to have cells with too small counts to make chi2-approximation invalid. If the table was a 2x2 contingency table I would like to use a Fsher exact test (fisher.test) but that wont work in this general table. Does there exist a general function for this test. Best regards, Magnus
2003 Nov 03
3
A matrix is full rank is equal to having independent columns?
Dear R listers, Just a simple question. If we say an nxm matrix (n>m) is full rank of m, does this mean that this matrix has linearly independent columns? They are the same definition or needs some proof? Thanks for your answer. Fred [[alternative HTML version deleted]]
2018 May 04
0
RFC: virtual-like methods via LLVM-style RTTI
On 3 May 2018, at 22:09, David Zarzycki via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hello, > > In an effort to help LLVM-style projects save memory, I’ve been toying with some macros that provide an alternative to C++ vtables that use LLVM-style RTTI design patterns instead. Is this something that LLVM or sub-projects think is worth pursuing? Or are the macros below
2007 Jul 31
3
Nonlinear optimization with constraints
Hello R community, I am using R for creating a model using optimization. I would like to ask if there is R-function/package for solving the problem below: Minimize sum(abs(exp^(Ai1 x1 + Ai2 x2 + ... + Aim xm - bi) - 1)), for each i = 1, ..., n. subject to Ai1 x1 + Ai2 x2 + ... + Ajm xm - bi <= c, where c is a scalar. (x is a vector of variables, A is nxm matrix, b is a vector)
2009 May 08
3
'Dynamic' 3D plot
Hi, I am looking for a R package to draw 3d plot. But not in a static way like scatterplot3d or stuff like that. I would like to make rotate the plot, to zoom/unzoom etc..., actually to render the graph 'dynamic'... (for the biologist and bioinformatician, a R package which permitts to reproduce what pdb viewer does). Does a Way exist to do something like that in R ? Thanks,
2007 Mar 05
2
Linear programming with sparse matrix input format?
Hi. I am aware of three different R packages for linear programming: glpk, linprog, lpSolve. From what I can tell, if there are N variables and M constraints, all these solvers require the full NxM constraint matrix. Some linear solvers I know of (not in R) have a sparse matrix input format. Are there any linear solvers in R that have a sparse matrix input format? (including the
2011 Jul 19
3
calculating the mean of a random matrix (by row) and some general questions
Hi everyone! I'm trying to teach myself R in order to do some data analysis. I'm a mathematics student and (only) familiar with matlab and latex. I'm working trough the "official" introduction to R at the moment, while simultaneously solving some exercises I found in the web. Before I post my (probably stupid) question, I'd like to ask you for some general advice. How do
2003 Sep 18
2
R-1.7.1 package installation problem
Hi there, I am a bioinformatician working in DFCI. I am new to R. Yesterday I installed the R-1.7.1 to my Linux (since I am not able to find R-1.8 on the webpage). But I have some package installation problems ... 1. install.packages2() function isn't available. If I type at R prompt: >install.packages2("Biobase") Error: couldn't find function
2008 Nov 20
1
R course in Scotland
(apologies if this is the wrong list) I'm a bioinformatician looking for a course in using R, in particular the tools for working with the genome - I've heard they're lightning fast. I'm in Glasgow, but I've tried the Robertson centre for biostatistics and they use minitab. If anybody knows of a course, I would be grateful. Glasgow or Edinburgh would be preferable, but
2012 Apr 16
1
packages install dependencies
Hello R-Members I have to install several R packages on a Unix server which doesn't have internet connection. I downloaded some packages manually and I installed it from source using the command R CMD INSTALL and it's work but in some cases I can't install the package because of the dependencies. So I download all the R packages into a directory for example /home/joel/RPacks.
2006 Sep 21
1
How to generating diagnal blocks ?
Hi, I am trying to creat a matrix with diagnal blocks, say, I have a matrix X of any dimension (nxm) ,and would like to have: X X X
2009 Mar 13
1
Help with Function!
Dear All, I need to write 'n' functions on 'm' variables. The functions should be constructed according to the values of an (nxm) matrix of '1/0' values as follows. For example, if row1 is equal to ,say [1 0 .......0 0] then f1 <- (1+x1) if row 2 is equal to, say [1 1 1 0...0 1] then f2 <-(1+x1)*(1+x2)*(1+x3)*(1+xm) if row n is equal to [0 1 0 1 1 0 ..... 0] then
2009 Dec 04
1
Converting a Matrix in a colum vector
Hi all, Imagine I have a matrix G with N rows and M columns So L=NxM is the number of different cells in my matrix. I want to create a column vector F whose size will be F(L,1) So the fisrt row in F is G(1,1) Second row in F is G(1,2) When we arrive to a point M the element M+1 will be G(2, 1) Element M+2 will be G(2,2) and so on. I´m trying but allways error.... Easy Example: G= 2 3 4
2011 Aug 20
1
t() prior to data rotation
Dear All, I have come upon an R-mode PCA protocol that uses the following arguments, where "mydata.txt" is an nxm matrix of n objects and m variables: > a <- read.table("mydata.txt") > b <- t(a) > c <- prcomp(b) > c$rotation The user then plots the coordinates given by c$rotation (PC1 and PC2) as the "scores" of their PCA plot. This
2012 Jul 31
1
ways of getting around allocMatrix limit?
I need to multiply to very large, nonsparse matrices, and so get the error "allocMatrix: too many elements specified". Is there a way to set the limit for allocMatrix? In my case, the two matrices, A and B, are nxm and mxp where m is small, so I could subdivide each into blocks of submatrices A=rbind(A1,A2,...) and B=cbind(B1,B2,...) then multiply each pair of submatrices, but I was
2009 Mar 04
5
Filtering R lists
Hello I am am new to R and any help with the following would be appreciated: I have a list (example attached) and I would like to create a new list which is a filtered version of this list. I.e I would like a list that only contains elements with this value: Chr 10 : 21853562 - 21855482 Any pointers/tips would be great. Thanks! Nikol -- Bioinformatician/Computer Associate Cambridge Institute