Displaying 20 results from an estimated 1941 matches for "rowname".
Did you mean:
rownames
2009 Mar 02
3
Error setting rowname if rowname currently NULL
Hi,
My first post here and new to R so please bear with me (long time programmer
though, helping a friend with some scripts).
I've noticed a behaviour when using rownames() that I think is odd,
wondering if I'm doing something wrong.
To illustrate, say I create a very simple matrix (called fred):
fred<-matrix(,4,2)
It looks like this:
[,1] [,2]
[1,] NA NA
[2,] NA NA
[3,] NA NA
[4,] NA NA
If I now try and set a row name for one of th...
2007 Jun 25
2
simultaneous actions of grep ???
Hello R-users and developers,
Once again, I'm asking for your help.
There is other way to do the same more easily for applied simultaneous
grep???
c<-subset(c,!rownames(c) %in% grep(".1",rownames(c),value=T))
c<-subset(c,!rownames(c) %in% grep(".5",rownames(c),value=T))
c<-subset(c,!rownames(c) %in% grep(".6",rownames(c),value=T))
c<-subset(c,!rownames(c) %in% grep(".99999",rownames(c),value=T))
Thanks...
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.
Assign...
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.
Assign...
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" = c(100,200),"Location2" =
c(200,400))
#Name rowns
rownames(DataToPlot..) <- c("Fa...
2009 Aug 27
5
Help on efficiency/vectorization
Dear R users,
I am trying to extract the rownames of a data set for which each columns
meet a certain criteria. (condition - elements of each column to be equal
1)
I have the correct result, however I am seeking for more efficient (desire
vectorization) way in implementing such problem as it can get quite messy if
there are hundreds of columns....
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...
2010 Aug 05
1
rbind on data.frame that contains a column that is also a data.frame
...t allowed
In addition: Warning message:
non-unique values when setting 'row.names': ?1?, ?10?, ?2?, ?3?, ?4?, ?5?,
?6?, ?7?, ?8?, ?9?
--
Looking at the code of rbind.data.frame, the error comes from the
lines:
--
xij <- xi[[j]]
if (has.dim[jj]) {
value[[jj]][ri, ] <- xij
rownames(value[[jj]])[ri] <- rownames(xij) # <-- problem is here
}
--
if the rownames() line is dropped, all works well. What this line
tries to do is to join the rownames of internal elements of the
data.frames I try to rbind. So the result, in my case should have a
column 'a'...
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...
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 20
> dim(GENE_NA...
2012 Mar 05
1
Order a data frame based on the order of another data frame
Hi, I am trying to match the order of the rownames of a dataframe with
the rownames of another dataframe (I can't simply sort both sets
because I would have to change the order of many other connected
datasets if I did that): Also, the second dataset (snp.matrix$fam) is
a snp matrix slot:
so for example:
data_one:...
2007 May 27
1
How to reference or sort rownames in a data frame
...uot;.
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 corresponding to rownames 17 and 23 are
outliers and high leverage.
I would then like to perform a fit without these two rows.
In principle this should be easy, using an update() with subset=-c(17,23).
The problem is that the rownames in this dataset are not ordered,
and, in fact, the relevant rows are 30 and 31, not...
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...
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 package. Here is my code:
(you need to be connected to bloomberg to run it):
conn <- blpConnect(na.action="na")
prices <...
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...
2011 Apr 02
2
Matrix manipulation
...I have a vector, let's say for example int <- sample(1:20,10);
for now:
now I have a matrix...
M = m x n
where the first column is a "feature" column and most likely shares at least
one of the int (interesting) numbers.
I want to extract the rows where int[] = M[,1]
I thought:
rownames(int)<-int;
rownames(M)<-M[,1];
M[rownames(int),] would work, but it doesn't... (I assume because I have
rownames(int) that are not found in M[,1]. Neither does,
rownames(M)==rownames(int)...
Any help would be greatly appreciated!
Thank you!
[[alternative HTML version deleted]]
2010 Dec 01
1
attempted merge() returns: cannot coerce type 'closure' to vector of type 'any'
Hi Dimtris and esteemed useRs,
I don't understand why i get this error message when attempting to use
merge() -
> temp <- merge(x, y[,17, drop=FALSE], by=rownames, sort=FALSE)
Error in as.vector(x, mode) :
cannot coerce type 'closure' to vector of type 'any'
It should work because:
> all(rownames(x[order(rownames(x)),]) ==
+ rownames(y[order(rownames(y[,17, drop=FALSE])),17, drop=FALSE]) ....
[TRUNCATED]
[1] TRUE
also:
> clas...
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 dimensions.
My scripts are all written with heavy references to matching of
colnames...
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. Lik...
2007 Mar 03
0
2 bugs in max.col() (PR#9542)
...sting before publishing it. Please note that the code was developed under R 1.6.2 and might need porting to R 2.4.1 .
Best regards
Jens Oehlschl?gel
# -- output of max.col under 2.4.1. ------------------------
> x <- rbind(c(1,1), c(0,0), c(-Inf, 0), c(0, Inf), c(0, NA), c(NA, 0))
> rownames(x) <- paste("c(", apply(x, 1, paste, collapse=","), ")")
> x
[,1] [,2]
c( 1,1 ) 1 1
c( 0,0 ) 0 0
c( -Inf,0 ) -Inf 0
c( 0,Inf ) 0 Inf
c( 0,NA ) 0 NA
c( NA,0 ) NA 0
>
> cat("ties not broken for c(0,0)...