similar to: Error setting rowname if rowname currently NULL

Displaying 20 results from an estimated 20000 matches similar to: "Error setting rowname if rowname currently NULL"

2008 May 19
2
Sort matrix with duplicate row names alphabetically by rowname
Hi, I've a matrix that contains 4 replicates of each rowname. (4 a's, 4 b's, 4 c's in no particular order) Like this: # c 32 a 1 b 4 c 87 c 34 b 54 a 23 a 12 b 9 a 3 b 87 c 43 There are a couple of more columns but I'm using the above as an example I need to sort it so that the same rownames appear together in alpahbetical order. Like this: # a 1 a 23 a 12 a 3 b 4
2008 Sep 17
3
using for variable as rowname
Is there a way to use the cycle variable for rowname? v=1:6 for (a in 1:3){ for (b in 4:5) { v=rbind(v,a.b=1) } } v This above obviously does not work, but I couldn't find out how to use a and b to construct a rowname like 14, 15, 24, 25. Thanks for the help. Balazs -- View this message in context: http://www.nabble.com/using-for-variable-as-rowname-tp19533203p19533203.html Sent from
2008 Jan 04
1
predict.lm removes rownames for a single row. Why?
predict.lm keeps row names when working from several rows in newdata, but always removes rowname from a single row. The rownames are removed by the line in predict.lm predictor <- drop(X[, piv, drop = FALSE] %*% beta[piv]) What is the reason for that decision? I usually want to retain the row names. tmp <- data.frame(x=1:4, y=c(1,3,2,5)) tmp.lm <- lm(y ~ x, data=tmp) tmp.new <-
2004 Jun 11
4
rownames of single row matrices
Hi I want to extract rows of a matrix, and preserve rownames even if only one row is selected. Toy example: R> a <- matrix(1:9,3,3) R> rownames(a) <- letters[1:3] R> colnames(a) <- LETTERS[1:3] R> a A B C a 1 4 7 b 2 5 8 c 3 6 9 Extract the first two rows: R> wanted <- 1:2 R> a[wanted,] A B C a 1 4 7 b 2 5 8 rownames come through fine. Now extract just
2009 Jul 15
4
Extract pairs (rowname, columname) from a matrix where value is 0
Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from which the value in the matrix is 0 The result should be something like this A1, F1 A2,
2008 Oct 30
1
row.names(data.frame(matrixWithDimnames)) depends on first rowname being "" or not. (PR#13230)
Full_Name: Bill Dunlap Version: R version 2.9.0 Under development (unstable) (2008-10-29 r46795) OS: Linux Submission from: (NULL) (76.28.245.14) When data.frame() is given a matrix with rownames, then the type of the output row names depends on whether the first element of the input row names is "" or not. The other elements of the input row names don't affect things. E.g.,
2005 Dec 10
1
how to extract the row names of a matrix using for loop or other looping
Hi all, I have a matrix and its cluster...and i like to extract the row names of each cluster....but using the for loop or some other looping a<-matrix(c(seq(3,45,3),seq(10,6,-1)),4,5,byrow=F) col<-c("ra","rb","rc","rd","re") rows<-c("ca","cb","cc","cd") dimnames(a)<-list(rows,col) a
2009 Jul 27
2
Split rownames into factors
Hi Guys, I was wondering how you would go about solving the following problem: I have a list where the grouping information is in the row names. Rowname [,1] X1Jan08 324 X1Jun08 65 X1Dec08 543 X2Jan08 23 X2Jun08 54 X2Dec08 8765 X3Jan08 213 X3Jun08 43 X3Dec08 65 How can I create the following dataframe: Value Date Group [1,] 324 Jan 08 X1 [2,] 65 Jun 08
2010 Aug 16
1
Combining values from a data.frame row with matrix rownames.
Hello, I am trying to iteratively build a build a panel of variables to discriminate between two groups. My starting position is a matrix of experimental data and I have a function that will work through all pairs of variables and produce sensitivities, specificities and p-values for each pair and write it to a file (above particular cut-offs). I have a second function that will read that file
2012 Nov 29
1
Coerce rownames to factor for ordering
Hi all, I think this might be an easy one but I cannot think of a way to do this other than what I am currently attempting. I simply want to sort my data frame's rownames by a defined vector so that the plots I generate from that vector are in the desired order Consider the test data below: #Create test data DataToPlot.. <- data.frame("Location1" =
2002 Aug 01
1
Non-alignment of <NA> in rownames
Hello everyone, Apologies in advance if you have received this multiple times! On a thread similar to that posted by Don MacQueen (http://www.r-project.org/nocvs/mail/r-help/2002/3455.html): is there any way to nicely format NA's when listed as rownames? When NA's are part of rownames, the alignment is thrown off: > z <- matrix(c(100, 200, 300)) > z [,1] [1,] 100 [2,]
2010 Feb 05
1
Strange "rownames"
I find one row in my large dataset. But when I use the "rownames" for the data on the 100,000 row, the result show nothing. I try it by the following example, it still likes that. > tst[rownames(tst)==100000,] [1] x y <0 rows> (or 0-length row.names) ############## > tst=data.frame(x=1:200000,y=200000:1) > tst[rownames(tst)==1,] x y 1 1 200000 >
2006 Mar 21
3
ROWNAMES error message
I am getting an error message, which I do not know the source to. I have a matrix SAMPLES that has preexisting rownames that I would like to change. GENE_NAMES contains these rownames. > rownames(SAMPLES) = GENE_NAMES Error in "dimnames<-.data.frame"(`*tmp*`, value = list(list(V1 = c(3843, : invalid 'dimnames' given for data frame > dim(SAMPLES) [1] 12626
2009 Jul 13
2
how to keep row name if there is only one row selected from a data frame
Hi, there: Assume I have a dataframe with rownames like A with rownames like a to e, > A [,1] [,2] a 1 6 b 2 7 c 3 8 d 4 9 e 5 10 when I use A[1,], I lost the rowname for it, like below. How could I keep it? Is there an easy way instead that I have to modify by myself after I used A[1,] manually. > A[1,] [1] 1 6 Thanks, W. -- Weiwei Shi, Ph.D Research
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
2006 Jul 06
3
Comparing two matrices
hi: I have matrix with dimensions(200 X 20,000). I have another file, a tab-delim file where first column variables are row names and second column variables are column names. For instance: > tmat Apple Orange Mango Grape Star A 0 0 0 0 0 O 0 0 0 0 0 M 0 0 0 0 0 G 0 0 0 0 0 S 0 0 0 0 0
2005 Dec 09
3
[R] data.frame() size
Hi, Please see below for post on r-help regarding data.frame() and the possibility of dropping rownames, for space and time reasons. I've made some changes, attached, and it seems to be working well. I see the expected space (90% saved) and time (10 times faster) savings. There are no doubt some bugs, and needs more work and testing, but I thought I would post first at this stage. Could some
2004 May 13
2
xtable without rownames
When I tried to read all the entries (after searching the FAQ) for "row names xtable", I get START-INFO-DIR-ENTRY * R FAQ: (R-FAQ). The R statistical system ... ... xtable* Export data to LaTeX and HTML tables. ... For dropping the row names of a matrix `x', it may be easier to use `rownames(x) <- NULL', similarly for column ...
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
2000 Mar 09
1
For the record: how to merge data frames vertically
Hello, to save searching time in the S-news archive, here is the simple solution to merge data frames vertically (cols must be equivalent, of course). The frames must be components of a list, such as produced by framelist<-split(bigframe,factor). bigframe2<-do.call("rbind",framelist) # posted to S-news by Bill Venables, found in summary message