search for: submatrix

Displaying 20 results from an estimated 56 matches for "submatrix".

2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
...ith '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 online here: https://github.com/kevinushey/s4inherits This package, 's4inherits', defines an S4 class, 'SubMatrix', that inherits from the 'dsyMatrix' class defined in the Matrix package. After installing the package, I run some simple tests: $ R -f test-save.R > library(s4inherits) > data <- SubMatrix(1) > > is(data, "SubMatrix") [1] TRUE > inherits(data, "SubMat...
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 each time, I have to use as.matrix() to convert the vector back to matrix. It is very annoying! -- View this message...
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 deleted]]
2003 Oct 13
2
colnames from submatrix?
...as > colnames( qr( attr( eval( nlsystemols$eq[[1]]$deriv ), "gradient" ) )$qr ) will return > [1] "d0" "d1" "d2" "s0" "s1" "s2" "s3" Is/Are there one of those great S or R function/shortcuts that will return a submatrix(?) or a partioned matrix such that when I call colnames() I get: > [1] "d0" "d1" "d2" Thanks, Jeff.
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
...now; at least, why exporting > the class resolves this particular issue. > > Firstly, when an S4 class is not exported, the associated > '.__C__<class>' object is not made part of the package environment. > For example, I see: > > > getAnywhere(".__C__SubMatrix") > A single object matching '.__C__SubMatrix' was found > It was found in the following places > namespace:s4inherits > with value > < ... > > > Note that the symbol is only discovered in the package namespace. When > the class is ex...
2016 Jul 29
0
strange behavior in 'inherits' check for loaded S4 object
...ll idea as to what's going on now; at least, why exporting the class resolves this particular issue. Firstly, when an S4 class is not exported, the associated '.__C__<class>' object is not made part of the package environment. For example, I see: > getAnywhere(".__C__SubMatrix") A single object matching '.__C__SubMatrix' was found It was found in the following places namespace:s4inherits with value < ... > Note that the symbol is only discovered in the package namespace. When the class is exported (e.g. with 'exportClasses(Su...
2012 Aug 23
1
Why was my R process killed spontaneously?
I tried to use gpuCor function in the gputools package of R to calcuate the pairwise correlations of a matrix of 40,000 columns. Becuase there would be memory issues if I use the whole matrix at a time, I splitted the matrix into submatrix of 10,000 columns and then calculate the pairwise correlation of different submatrices. There are altogether 4 submatrices, so I need to calculate the pearson correlation of sub matrix 1 with sub matrix 1,2,3,4, and sub matrix 2 with submatrix 1,2,3,4, etc. The program runs well at first, but at t...
2004 Sep 15
2
efficient submatrix extraction
Hi, I have a matrix of say 1024x1024 and I want to look at it in chunks. That is I'd like to divide into a series of submatrices of order 2x2. | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | | 1 2 3 4 5 6 7 8 ... | ... So the first submatrix would be | 1 2 | | 1 2 | the second one would be | 3 4 | | 3 4 | and so on. That is I want the matrix to be evenly divided into 2x2 submatrices. Now I'm also doing this subdivision into 4x4, 8x8 ... 256x256 submatrices. Currently I'm using loops and I'm sure there is a mroe efficie...
2000 Feb 11
1
Creating efficiently a subset of a matrix
Dear R-helpers I have the following problem: given a m x n matrix A, I want to have just a m x k submatrix B, with B[i,] = A[i, offset[i] + 1:k], e.g. from > offset <- c(0, 0, 1) > a <- matrix(1:9, 3) > a [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 the submatrix b 1 4 2 5 6 9 I can do this with a for loop or with sapply > b <- sapply(seq(offs...
2004 Dec 17
2
Matrix and rownames problem
...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. When I'm taking a submatrix j<-i[1,1:2] the result should be (for me) an array of one line, and two colums. Here's the result: d e 1 3 When I want to access the rownames of j, it returns NULL. I want it to be "a". On the other side, if I take a submatrix 2x2, there is no problem. In my problem, rownam...
2016 Jul 31
2
strange behavior in 'inherits' check for loaded S4 object
...esolves this particular issue. >>> >>> Firstly, when an S4 class is not exported, the associated >>> '.__C__<class>' object is not made part of the package >>> environment. For example, I see: >>> >>>> getAnywhere(".__C__SubMatrix") A single object matching >>> '.__C__SubMatrix' was found It was found in the following >>> places namespace:s4inherits with value < ... > >>> >>> Note that the symbol is only discovered in the package >>> namespace. When the class i...
2007 Feb 09
1
extract submatrix with unique names
Dear list, I have a table where first 3 columns are identical if the name in the first column is the same, and the number in N4 is slightly different for all identical names, like this: ------------------------------------------------------------------- 29 Mm.1_at 3 + 93649936 30 Mm.1_at 3 + 93649990 31 Mm.1_at 3 + 93649993 32
2002 Oct 10
2
tapply for matrices
Does anyone have something like tapply that is extremely fast for matrices when there is a very large number of levels of the grouping variable? I'm referring to, for example, tapply(x, grouping.variable, function.operating.on.submatrix) where x is a matrix and the submatrix is a subset of the rows of x. The grouping variable's length equals the number of rows of x. -- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia S...
2004 Feb 09
5
simple question on picking out some rows of a matrix/data frame
...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
2016 Jul 30
0
strange behavior in 'inherits' check for loaded S4 object
...solves this particular issue. >> >> Firstly, when an S4 class is not exported, the associated >> '.__C__<class>' object is not made part of the package >> environment. For example, I see: >> >> > getAnywhere(".__C__SubMatrix") A single object matching >> '.__C__SubMatrix' was found It was found in the following >> places namespace:s4inherits with value < ... > >> >> Note that the symbol is only discovered in the package >> namespace. When the class i...
2009 Jun 02
2
bigmemory - extracting submatrix from big.matrix object
I am using the library(bigmemory) to handle large datasets, say 1 GB, and facing following problems. Any hints from anybody can be helpful. _Problem-1: _ I am using "read.big.matrix" function to create a filebacked big matrix of my data and get the following warning: > x = read.big.matrix("/home/utkarsh.s/data.csv",header=T,type="double",shared=T,backingfile
2007 Apr 25
1
for loops
...9;m very new at using R so probably this is a very stupid question. I have a matrix of "p" columns and I have to calculate for each of them the "two sample t-statistic" and p-value and to save the results into two different vectors. I have divided my matrix into two submatrices: submatrix A containing the first "n1" rows (p columns) and submatrix B containing the remaining "n2" (total rows=n1+n2). How can I do this with for loop construction? Friendly regards Silvia ------------------------------------------------------ Passa a Infostrada. ADSL e Telefono senza...
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 help mailing list archive at Nabble.com.
2016 Aug 02
0
strange behavior in 'inherits' check for loaded S4 object
...r issue. >>>> >>>> Firstly, when an S4 class is not exported, the associated >>>> '.__C__<class>' object is not made part of the package >>>> environment. For example, I see: >>>> >>>>> getAnywhere(".__C__SubMatrix") A single object matching >>>> '.__C__SubMatrix' was found It was found in the following >>>> places namespace:s4inherits with value < ... > >>>> >>>> Note that the symbol is only discovered in the package >>>> namespac...
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 = submatrix(a,fromx=1,tox=2,fromy=1,toy=2) b #...