similar to: row.names != rownames for data.frame?

Displaying 20 results from an estimated 10000 matches similar to: "row.names != rownames for data.frame?"

2000 Dec 11
2
row.names, rownames; colnames, no col.names?
There's a bit of a symmetry issue, which may or may not be important (led to 15 seconds of confusion until I got my bearings straight): row.names, rownames; colnames, no col.names? I _NOW_ realize the difference between row.names and rownames, but is there any reason not to have col.names for re-naming columns in a data.frame? (if there is, I don't particular need to know it, but it
2016 Apr 03
2
row.names(), rownames(), colnames(), names() ...?
The help text for row+colnames {base} states: "For a data frame, rownames and colnames eventually call row.names and names respectively, but the latter are preferred." Why are they "preferred"? Why is it names(), not col.names()? I have only ever used names() for vectors - I'm surprised it works on data.frames... IMO this is not great for code readability, thus
2016 Apr 03
0
row.names(), rownames(), colnames(), names() ...?
Data frames are lists of columns. The names() function is appropriate for lists. It doesn't pay to fall into the trap of thinking that data frames are truly symmetric between columns and rows, because there is a performance penalty for accessing rows that is greater than the cost of accessing columns. With that in mind, thinking of data frames as lists is preferred, so names is preferred
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
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 <-
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
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
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" =
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP) According to the documentation, rownames and colnames are character vectors. Assigning a vector of class POSIXct or POSIXlt as rownames or colnames therefore is not strictly according to the rules. In some cases, R performs a reasonable typecast, but in some other cases where the same typecast also would be possible, it does not. Assigning a
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP) According to the documentation, rownames and colnames are character vectors. Assigning a vector of class POSIXct or POSIXlt as rownames or colnames therefore is not strictly according to the rules. In some cases, R performs a reasonable typecast, but in some other cases where the same typecast also would be possible, it does not. Assigning a
2007 May 27
1
How to reference or sort rownames in a data frame
As I was working through elementary examples, I was using dataset "plasma" of package "HSAUR". In performing a logistic regression of the data, and making the diagnostic plots (R-2.5.0) data(plasma,package='HSAUR') plasma_1<- glm(ESR ~ fibrinogen * globulin, data=plasma, family=binomial()) layout(matrix(1:4,nrow=2)) plot(plasma_1) I find that data points
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 Jul 03
1
rownames, colnames, and date and time
Hi all I was wondering whether there has ever been an update on the rownames and colnames behaviour as described by Eric below? I still get the same behaviour, exactly as described by Eric, on my WinXP installation of R-2.3.0. I also posted a message to r-help on Friday but looking through the online archives it seems to have not made it to the list. I would agree with Eric that a consistent
2010 Mar 17
2
Troubles on retrieving rownames
Hi guys, I am using the blp() function from RBloomberg package which returns a matrix of prices with the columns corresponding to the security name and the columns to the date. When I have a look at the matrix I can see the rownames (dates) on the left of the prices but when I call the rownames() function it returns me a NULL value. It worked perfectly until I had to reinstall the RBloomberg
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 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
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
2006 Sep 14
1
R-devel: rownames of a data.frame
Hello! Data.frames have new rownames funcionality, however in use of colnames<- in R-devel "changes" this. Here is the example: > df1 <- data.frame(letters[1:5]) > attributes(df1) $names [1] "letters.1.5." $row.names [1] 1 2 3 4 5 $class [1] "data.frame" > colnames(df1) <- "bla" > attributes(df1) $names [1] "bla"
2002 Mar 04
2
Plotting a x axis from a vector with rownames
Hi all, suppose there is a vector y with rownames: > y cond1 cond2 cond3 cond4 78.952 87.308 86.490 74.040 how can I easily plot this vector using the rownames? plot(y) gives me a plot with a x-axis from 1 to 4 in 0.5 steps, also plot(rownames(y), y) and plot(y ~ rownames(y) don't work. I know I can build a x-axis with axis(1, ...), but in this case I need a character string like
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