similar to: naming rows and columns in a matrix

Displaying 20 results from an estimated 60000 matches similar to: "naming rows and columns in a matrix"

2011 Mar 01
2
Entering table with multiple columns & rows
Hi, I'm having difficulty with getting a table to show with multiple rows and columns. Below is the commands that I've typed in and errors that I am getting. Thank you. Laura Table trying to enter: Diet: Binger-yes: Binger-No: Total: None 24 134 158 Healthy 9 52 61 Unhealthy 23 72 95 Dangerous 12 15 27 >
2012 Mar 29
1
Retrieving matrix column and row names by index value
Hi all, So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example, > mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2", "C.3"))) > mdat[4] [1] 12 >
2012 May 22
1
Naming dimnames in an array using the results of an expression
dear all i'm struggling with naming in an array diag.data is one of a series of 2x2 diagnostic testing arrays, with 'Outcome' columns (true/false) and 'Test' rows (High-risk, Low-risk), drawn from a larger list object of 'results' i can hard-code the names of the array using dimnames; diag.data<-array(c(19,2,125,50),c(2,2)) #example to run - actually comes out
2007 Nov 12
1
update matrix with subset of it where only row names match
I guess this has a simple solution: I have matrix 'mat1' which has row and column names, e.g.: A B C row1 0 0 0 row2 0 0 0 .... rown 0 0 0 I have a another matrix 'mat2', essentially a subset of 'mat1' where the rownames are all in 'mat1' e.g.: B row3 5 row8 6 row54 7 I want to insert the values of matrix mat2 for column B (in reality it could be some or
2006 Feb 21
2
Limit of matrix + naming
Hi all, I have read a data matrix of 304 x 404 using read.table. When I am trying to name the colnames, with first try colnames(L5)<-list(2:305), I keep getting error message such as Error in "colnames<-"(`*tmp*`, value = list(c(2, 3, 4, 5, 6, 7, 8, 9, : length of 'dimnames' [2] not equal to array extent and I don't know why. But, if I look at
2009 Oct 27
2
column names of a correlation matrix
Hi! All, I am working on a correlation matrix of 4217x4217 named 'cor_expN'. I wish to obtain pairs with highest correlation values. So, I did this > b=matrix(data=NA,nrow=4217,ncol=1) > rownames(b)=rownames(cor_expN) > for(i in 1:4217){b[i,]=max(cor_expN[i,])} > head(b) [,1] aaeA_b3241_14 0.7181912 aaeB_b3240_15 0.7513084 aaeR_b3243_15 0.7681684
2005 Dec 06
2
how to extract row& col names from a matrix
Dear all, I like to extract row names & column names from the named matrix...... like...... a<-matrix(1:6,2) ro<-c("aa","bb") co<-c("dd","ee","ff") dimnames(a)<-list(ro,co) a > dd ee ff aa 1 3 5 bb 2 4 6 from the above matrix "a" I like to extract rownames separately like
2011 Apr 20
2
get cells by the combination of their column and row names
Hi, I have a (correlation) matrix and I want to select a subset of its cells depending on the combination of their column and row names. This illustrates my problem: mtrx <- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3, ncol=3, dimnames = list(c('c132','c432', 'c233'), c('r132','r233', 'r432')))> mtrx r132 r233 r432c132 1 4 7c432 2
2007 Nov 26
2
colnames slow (PR#10470)
Full_Name: Tomas Larsson Version: 2.6.0 OS: Windows XP Submission from: (NULL) (198.208.251.24) This is not a bug, it is a performance issue but I think it should have an easy fix. I have a large matrix (about 2,000,000 by 20), when I type colnames(x) it takes a long time to get the result. However, if I select just the first couple of rows of the matrix I don't have to wait for the
2007 Aug 16
4
Combine matrix
Hi R user, I am new to R, and I have a very simple question for you. I have two matrix A and B, with internally redundant rownames (but variables are different). Some, but not all the rownames are shared among the two matrix. I want to create a greater matrix that combines the previuos two, and has all the possible combinations of matching rownames lines among matrix A and B. looking for the
2009 May 17
1
[wishlist, patch] make row() and col() preserve dimnames (PR#13705)
Full_Name: Ben Goodrich Version: 2.9.0 OS: Linux (Debian unstable) Submission from: (NULL) (128.103.220.16) row(x), col(x), and functions that call them like lower.tri(x) and upper.tri(x) do not retain the rownames or colnames of x in the matrix that is returned. Example from R version 2.9.0 : x <- matrix(1:9, nrow = 3, ncol = 3) rownames(x) <- LETTERS[1:3] colnames(x) <- letters[1:3]
2004 Aug 20
3
Loss of rownames and colnames
Hi, I am working on some microarray data, and have some problems with writing iterations. In essence, the problem is that objects with three dimensions don't have rownames and colnames. These colnames and rownames would otherwise still be there in 2 dimensional objects. I need to generate multiple iterations of a 2 means-clustering algorithm, and these objects thus probably need 3
2009 Mar 25
3
Converting a Matrix to a Vector
Say I have: > set.seed( 1 ) > m <- matrix( runif(5^2), nrow=5, dimnames = list( c("A","B","C","D","E"), > c("O","P","Q","R","S") ) ) > m O P Q R S A 0.2655087 0.89838968 0.2059746 0.4976992 0.9347052 B 0.3721239 0.94467527 0.1765568
2013 Sep 05
2
binary symmetric matrix combination
Hi, May be this helps: m1<- as.matrix(read.table(text=" y1 g24 y1 0 1 g24 1 0 ",sep="",header=TRUE)) m2<-as.matrix(read.table(text="y1 c1 c2 l17 ?y1 0 1 1 1 ?c1 1 0 1 1 ?c2 1 1 0 1 ?l17 1 1 1 0",sep="",header=TRUE)) m3<- as.matrix(read.table(text="y1 h4??? s2???? s30 ?y1 0 1 1 1 ?h4 1 0 1 1 ?s2 1 1 0 1 ?s30 1 1 1
2000 Nov 16
2
assign names to matrix
dear all, i have a matrix and i dont know how to assign names to this matrix. given v is 100x5 matrix, and label -> c("A","B","C","D","E") idealy, names(v) <- label, but it doesnt work for different length if dimnames(v) <- list(1:nrow(v),label), then names(v) return NULL any smart ways? thanks in advance. best regards pan yuming
2010 Mar 19
5
Merging Matrices
I have two symmetric matrices, but of different dimensions. The entries are identified by specific labels some of which are shared by both matrices. I would like to sum the two matrices, but retain the union of the two. In other words, I want the result to be the same size as the larger of the two matrices, but with the entries that they share added together. cbind() and rbind() don't
2010 Mar 12
3
defining columns in a matrix
Hi all, I have the following 7 x 7 matrix. ?I am trying to figure out how to label the columns to something more descriptive other than [,1], [,2], etc. I have tried the c(x,y,z,) function, but I get a error returned stating that my vectors need to be the same length. Do I need to convert this to something else such as a list and then repack it? Thanks, Kindra ?? ? ? ? Volume Time ? ? ? ?[,1]
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Use grep to get the row indices and then subset with a *negative* index to remove those rows. rn <- scan(what = character(), text = " 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 ") mat <- matrix(rnorm(6*6), nrow = 6) row.names(mat) <- rn inx <- grep("73\\.", row.names(mat)) new_mat <- mat[-inx, ] new_mat Hope this helps, Rui Barradas On
2018 May 22
4
remove rows of a matrix by part of its row name
Dear R-experts, How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 Now I would like to remove all the rows that contain the text 73.1 Any ideas or suggestion please ? Regards ********************** Ahmed Serag Analytical
2003 Dec 17
1
Accessing row and col names of SEXP objects
Can someone lend me a hand with extracting the dimnames from a SEXP? I've looked through R-exts, but I couldn't find an example. Here is the code I'm using to grab the jth column name and print it, but the colnames I'm getting are garbage. None of the following are working. void printInfo(SEXP ts) { int j; for (j=0; j<col; j++) {