similar to: Extracting only the non-repeated rows of matrices

Displaying 20 results from an estimated 40000 matches similar to: "Extracting only the non-repeated rows of matrices"

2009 Jul 02
2
matching rows in matrices
I have a matrix such as this, [,1] [,2] [,3] [1,] 1 1 2 [2,] 2 5 5 and a larger matrix such as this, a b [1,] 1 5 [2,] 2 5 [3,] 4 9 [4,] 5 8 [5,] 7 8 [6,] 7 10 [7,] 9 10 what I want to do is check the number of times the columns in the first matrix appear as rows in the second matrix. So for instance in this example 1,5 and 2,5 appear in both so I'd want
2012 Mar 07
1
extract same columns and rows in two matrices
Hello, I have two matrices. They both have different row names and column names, but they have some common row names and column names. The row names and column names that are the same are what I am interested in. I also want the columns in the two matrices aligned the same. In the end, I need to do rd[1,1] and ua[1,1], for example and be accessing the same column and row for both matrices. Thank
2009 Jun 26
1
Deleting repeated rows
Appologies if this is a simple problem. I have a matrix which is 86x3 and each row contains three integers. The problem I have is that some of the rows of integers are repeated in other rows and I only wish to have one copy of these rows. Is there a function that I can use which will identify these repeated rows and delete them from the matrix? I have searched for help with this problem but the
2005 Apr 13
2
extracting one element of correlation matrices from a list poroduced by the 'by' statement
I am producing 2X2 correlation matrices by a class variable. I need to extract a vector of correlation coefficients only. I am doing that in a loop (see below) but I am sure there would be a simpler way. Please help! > by(d1[,c(2,3)],d1[,1],cor) d1[, 1]: 1 c e c 1.0000000 0.1972309 e 0.1972309 1.0000000
2012 Nov 11
2
changing the signs in rows or columns in matrices and check them if they are identical
Dear R users, i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want   1 -1  1                                 -1  1   1 -1   1  -1                                1  -1  -1   1  1   -1                                1   1  -1 this two matrices are isomorphic beacause if i change the first 2 columns the matrices
2008 Jul 15
1
manipulating (extracting) data from distance matrices
Hi all, Does anyone have any tips for extracting chunks of data from a distance matrix? For instance, if one was interested in only a subset of distance comparisons (i.e., that of rows 4 thru 6, and no others), is there a simple way to pull that data out? >From some playing around with an example (below), I've been able to figure out that a distance matrix in R is stored as a single
2010 Jan 14
1
Extracting data from a list of matrices
Hi, Apologies in advance for the basic nature of my question. I am still very much a rookie when it comes to R. Having googled it, checked Nabble and trial/error to the best of my ability, I have yet to find an easy solution. I am currently working with a list of 5x5 matrices, and want to extract a list consisting of the first number of each matrix. In other words I want to go from: [[1]]
2010 Nov 15
1
Non-positive definite cross-covariance matrices
I am creating covariance matrices from sets of points, and I am having frequent problems where I create matrices that are non-positive definite. I've started using the corpcor package, which was specifically designed to address these types of problems. It has solved many of my problems, but I still have one left. One of the matrices I need to calculate is a cross-covariance matrix. In other
2004 Jun 29
2
binding rows from different matrices
Hello list, I have 3 matrices with same dimension : > veca=matrix(1:25,5,5) > vecb=matrix(letters[1:25],5,5) > vecc=matrix(LETTERS[1:25],5,5) I would like to obtain a new matrix composed by alternating rows of these different matrices (row 1 of mat 1, row 1 of mat 2, row 1 of mat 3, row 2 of mat 1.....) I have found a solution to do it but it is not very pretty and I wonder if I
2007 Aug 10
1
[Fwd: Re: How to apply functions over rows of multiple matrices]
[Apologies to Gabor, who I sent a personal copy of the reply erroneously instead of posting to List directly] [...] > Perhaps what you really intend is to > take the average over those elements in each row of the first matrix which correspond to 1's in the second in the corresponding > row of the second. In that case its just: > > rowSums(newtest * goldstandard) /
2012 Jan 27
1
repeat function for entire list of matrices
hi all. perhaps someone can help me with subsetting here............ i'm trying to use the nested() function in the bipartite package. my problem is that i have a list of 10,000 matrices and i want the output to be a vector of the nested() function on each of the 10,000 matrices (so i can use these numbers in a statistical test). here is what i'm working with currently: #to store
2008 Feb 13
2
How to handle Which on two matrices that do not have same number of rows
R-newbie question I have 2 matrices (a) P1 has only one column of 32K rows (b) PC has 2 column {P, C} of 3200 rows Every values in P1 matches with a value in PC[,p] (column p). I would like to use Which to search for all value in P1 that matchex PC[,p] and get the PC[,c]. However because P1 and PC does not have the same number of rows, I got lots of 'NA'. Thanks for your
2011 Nov 04
1
Counting number of common elements between the rows of two different matrices
Hello I'm trying to solve this problem without using a for loop but I have so far failed to find a solution. I have two matrices of K columns each, e.g. (K=5), and with numbers of row N_A and N_B respectively A = (1 5 3 8 15; 2 7 20 11 13; 12 19 20 21 43) B = (2 6 30 8 16; 3 8 19 11 13) (the actual matrices have hundreds of thousands of entry, that's why I'm keen to avoid
2012 Nov 30
3
repeating matrices in a list
Suppose I have the following square, non-negative matrices > g=matrix(c(0,2,4,0.25,0,0,0,0.6,0),3,3,byrow=T); I want to create a list where this matrix is repeated multiple times. if I do this brute force (manually), using > env <- list(g,g,g) works fine. Yields [[1]] [,1] [,2] [,3] [1,] 0.00 2.0 4 [2,] 0.25 0.0 0 [3,] 0.00 0.6 0 [[2]] [,1] [,2] [,3] [1,]
2005 Nov 21
3
Comparing rows of matrices with different dimensions
Hi there, I have a question, which I thought is very easy to solve, but somehow I can't find a solution. Probably someone could help me quickly? Here it is: I have two matrices: a [,1] [,2] [,3] [1,] 1 4 9 [2,] 2 6 10 [3,] 3 6 11 [4,] 4 8 12 b [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 Now I want to find
2005 Feb 21
5
Compare rows of two matrices
Hello, #I have two matrices, eg.: y <- matrix( c(20, NA, NA, 45, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) x <- matrix( c(20, NA, NA, NA, 50, 19, 32, 101, 10, 22, NA, NA, 80, 49, 61, 190), ncol=4 ) #Whereas x contains all NA?s from y plus some additional NA?s. #I want to find the index of these additional NA?s. I think, there must be a very
2007 Aug 09
1
How to apply functions over rows of multiple matrices
Dear ExpRts, I would like to perform a function with two arguments over the rows of two matrices. There are a couple of *applys (including mApply in Hmisc) but I haven't found out how to do it straightforward. Applying to row indices works, but looks like a poor hack to me: sens <- function(test, gold) { if (any(gold==1)) { sum(test[which(gold==1)]/sum(which(gold==1))) } else NA }
2010 Oct 23
1
bind matrices by row
Hi R-users I have a series of matrices and I would like to bind them together by column using a loop (i.e. not writing cbind(matrix1, matrix2,matrix3....)). The reason is because in my real data set I have a very large number of matrices. Example: matrix1 <- matrix (1:12,4,3) matrix2 <- matrix (13:24,4,3) matrix3 <- matrix (25:36,4,3) matrix4 <- matrix (37:48,4,3)
2012 Nov 11
0
Changing the signs in rows or columns in matrices and check the matrices if they are identical
i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want   1 -1  1                                 -1  1   1 -1   1  -1                                1  -1  -1   1  1   -1                                1   1  -1 this two matrices are isomorphic beacause if i change the first 2 columns the matrices are identical
2007 Jan 21
1
Working with a set of matrices
Hi, I have a set of matrices (MAT.1, MAT.2, ...) and I'd like to perform the same operation on each of them (for simplicity, say . I'm writing a function for this so that it can be repeated for different sets with different numbers of matrices. The matrices have the same number of columns, but do not have the same number of rows. My thought is to loop thru the set. but I'm not sure