similar to: Creating efficiently a subset of a matrix

Displaying 20 results from an estimated 10000 matches similar to: "Creating efficiently a subset of a matrix"

2000 Mar 30
1
Efficiency of local functions
Dear R-users In order to speed up the performance of my program I tried to make a function f2 (that is only called from function f1) local to f1. In that way I pass one argument less to f2, a huge matrix. (This matrix isn't changed inside f2, so - afaik - it is passed by reference and size doesn't matter.) Still I would have expected that f1 would be a little faster, but the opposit
2000 Jan 17
1
How to change several elements of an array simultaneously?
I have a matrix `m' and two vectors `rs' and `cs'. I want to change m at the positions (rs[1], cs[1]), (rs[2], cs[2]), ... to 1. Obviously I can do that by > m[rs + (cs-1) * dim(m)[1]] <- 1 but I would just be interested whether I am missing a more "intuitive" way of doing that. Thanks in advance, Peter ____________________________________________________________
2000 Sep 04
2
problems with R COMPILE in make
Dear R helpers I have a problem with R COMPILE. While the Makefile consisting of the lines SOURCES = imageio.c procbase.c readargs.c regSegs.c goodiesPH.c \ generalAnalysis.c edgeAggregation.c utilities.alga.c \ cs.parametrizing.c tst.so: $(SOURCES) R SHLIB -o $@ $(SOURCES) works fine, the Makefile with the target replaced by imageio.o: imageio.c R COMPILE imageio.c results in
2000 Sep 04
2
problems with R COMPILE in make
Dear R helpers I have a problem with R COMPILE. While the Makefile consisting of the lines SOURCES = imageio.c procbase.c readargs.c regSegs.c goodiesPH.c \ generalAnalysis.c edgeAggregation.c utilities.alga.c \ cs.parametrizing.c tst.so: $(SOURCES) R SHLIB -o $@ $(SOURCES) works fine, the Makefile with the target replaced by imageio.o: imageio.c R COMPILE imageio.c results in
2001 Mar 26
1
Problems with R CMD COMPILE within Makefile (PR#885)
Dear R-developpers This concerns a problem I posted about half a year ago on the R-help list and to which I got some answer by Duncan Temple Lang (see below), but the basic problem still continues. Even though I managed a workaround which is sufficient for me Martin Maechler asked me to send a toy example of the problem to R-bugs. So that's what I try here. The following Makefile will not
2000 Oct 02
4
Debugging dynloaded C-code with gdb
Dear R users I have started to use gdb for debugging dynloaded C code as described in `Writing R Extensions'. Unfortunately I have run into several problems that I haven't been able to solve: - using `n': how comes that the same line of code appears up to three times (and inbetween the next line and maybe even the second next one?) - using `print' resp. `display': How
2000 Jan 13
0
problems with understanding behaviour of glm
Dear R users, I don't understand, what happens in glm in the following example (note that in S-Plus this example finishes with an almost perfect fit, but also 49 warnings): > fit.small <- glm(SKR.ein.aus ~ ., family = binomial, data = daten, maxit=100) Error in (if (is.empty.model(mt)) glm.fit.null else glm.fit)(x = X, y = Y, : inner loop 2; can't correct step size In addition:
1999 Jul 12
2
how to find index of maximum?
Dear R-users, Is there a simple way to find the index of the maximum of a vector? Ex. 1 3 6 2 result: 3 Thanks for any help, Peter ____________________________________________________________ Peter Holzer phone: + 41 1 632 46 34 Seminar fuer Statistik, SOL F7 fax: + 41 1 632 10 86 (Sonneggstr. 33) <holzer at stat.math.ethz.ch> ETH (Federal
1999 Feb 10
1
problems with read.table
Dear R users, I have the following problem: I have a table in ASCII-format, separated with commas. I can read it as long as no field contains a comma itself. If one does, read.table doesn't function even though that field is double-quoted. Ex.: File "test.csv": Name,Strasse,PLZ Jsaac,Gossauerstrassee 29,9100 Roth-Bernasconi,"20, ch. des Fauvettes",1212 adressen <-
1998 Sep 03
2
a nasty error
Dear R-developers The basic function seq doesn't work properly: > seq(1,6,by=3) [1] 1 4 7 Looking at the source code of seq.default I found that strange fuzz thing "+ 0.4". Taking that away the seq works fine. My question is: Why has this fuzz thing been added? If it was for some rounding problems I would suggest to replace "0.4" by something much smaller. Peter
2004 Nov 04
3
keep dimension of a sub matrix
Hi, is there any way to keep a sub matrix dimension? exemple : i1<-1; i2<-1 j1<-2; j2<-3; ret <-matrix(1,4,4)[i1:i2,j1:j2] ; dim(ret) is NULL because the submatrix single col or single row is coerce to a vector automaticaly. How can i bypass this cast : submatrix->vector ??????? Thank you. --------------------------------- [[alternative HTML version
2010 Mar 29
4
Confusing concept of vector and matrix in R
Why does R need the concept of "Vector"? In my opinion, it is a useless and confusing concept. A vector is simply a special case of a matrix whose row or column number is equal to 1. When I take submatrix from one matrix and if row or column number is 1, R will automatically convert it into a vector. It is very straightforward that a submatrix of a matrix should be a matrix. In
2004 Dec 17
2
Matrix and rownames problem
Hi, I'm quite new to R, so excuse me if this problem has a simple solution. I'm working with an array, lets say i <- array(c(1:3,3:1), dim=c(3,2)) Then I want to give the rows and the columns names: rownames(i)<-c("a","b","c") colnames(i)<-c("d","e") The result is given below: d e a 1 3 b 2 2 c 3 1 Here comes my problem.
2004 Feb 09
5
simple question on picking out some rows of a matrix/data frame
Hi, I have a simple question about matrix/data frame manipulation. I have a data frame that looks a something like this X Y Z 1 0 "apples" -1 -1 "oranges" ... 0 -1 "bananas" and I'd like to pull out all the rows for which X and Y are (un)equal into a submatrix. How can I do that? Many thanks, Roger Levy
2007 Oct 15
2
Get data from matrix
Hi, I have a matrix that has a variable number of columns. I do not know, a priori, the number of columns. How can I get a sub matrix, for example, from row 10 to the end of the columns? In MatLab I would use something like this: SubMatrix = Matrix[10, 1:end] Thanks a lot. -- View this message in context: http://www.nabble.com/Get-data-from-matrix-tf4629336.html#a13218653 Sent from the R
2011 Aug 02
1
Functions for Sum of determinants of ranges of matrix subsets
Dear R-help list, Pls I have this problem. Suppose I have a matrix of size nxn say, generated as follows   z<-matrix(rnorm(n*n,0,1),nrow=n)   I want to write a function such that for i in 1:n, I will remove the rows and columns corresponding to i (so, will be left with n-1*n-1 submatrix in each cases). Now I need the sum of the determinant of each of this submatrices. As an example, if n=3, it
2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
Hi, (sorry for the wall of text; the issue here appears to be rather complicated) I'm seeing a somewhat strange case where checking whether an S4 object inherits from a parent class defined from another package with 'inherits' fails if that object is materialized through a call to 'load'. That's a mouthful, so I've put together a relatively small reproducible example
2005 May 13
4
Encryption
Hi All, I am using rsync to backup our office server to our Internet server (RHE). As an association for doctors we are looking at providing a backup service for their practices using rsync. As it would be patient data it would need to be encrypted. I have found a few options, namely esync wurt rsyncrypto Does anyone have experience with the above and perhaps like to recommend one? On the
2010 Jan 18
1
Sub-matrixes that are linked to the "Base matrix"
Hello, I'm am in the process of trying to port a RATS functions to R and have the problem, that RATS allows for the creation of submatrixes that are linked to their basematrix. Basically it should work like this: a = matrix(1:(4*3),4,3) a # [,1] [,2] [,3] # [1,] 1 5 9 # [2,] 2 6 10 # [3,] 3 7 11 # [4,] 4 8 12 # This of course doesnt work :) b =
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
I should add one more item that may be related here -- calling 'methods:::.requirePackage' returns a different result based on whether the package namespace is already loaded or not. If the package namespace is not loaded, the package is loaded and attached, and the package environment is returned: > methods:::.requirePackage("digest") Loading required package: