Try this:
z[z[,1] 0,]
On Tue, Feb 9, 2010 at 6:12 PM, DonDiego jorge.nie...@moorecap.com wrote:
Hi,
I have a matrix of data values like the example bellow. I would like to
extract a subset of the matrix for the values where the first column is
negative. I am using the subset function.
Hi:
z = matrix(rnorm(n*m),n,m,dimnames =list(rnames,cnames))
z
x1 x2 x3 x4 x5
1 -0.3942900 -0.61202639 -1.804958629 -0.1351786 -1.27659221
2 -0.0593134 0.34111969 1.465554862 1.1780870 -0.57326541
3 1.1000254 -1.12936310 0.153253338
As others have said, z[z[, 1] 0, ] does it. Just in case
you're wondering why your subset command won't work,
str() is your friend (as is so often the case):
str(z)
str(as.data.frame(z)) ## (I don't think that R has 'as.data.set')
So z is a matrix with column *names* x1, etc;
as.data.frame(z)
Hi Carlos,
how about this step first:
rownames(mydata)-gsub(361a,00361a,rownames(mydata))
rownames(mydata)-gsub(456a,00456a,rownames(mydata))
good luck
milton
On Thu, Aug 27, 2009 at 12:27 PM, Carlos Gonzalo Merino Mendez
carlosgmer...@yahoo.com wrote:
Hello everyone, I would appreciate any
Hi Carlos,
I think I made a wrong suggestion. Sorry about that.
I was thinking that if you have the same rowname length it helps you on the
data handling. Is it true?! Case yes I can try suggest another automatic way
of you get it.
bests
milton
On Thu, Aug 27, 2009 at 12:39 PM, milton ruser
Try this:
lapply(data,
function(r)
lapply(split(r,
substr(sprintf(%05d, as.numeric(gsub([a-z], ,
row.names(r, 1, 3)), table))
On Thu, Aug 27, 2009 at 1:27 PM, Carlos Gonzalo Merino Mendez
carlosgmer...@yahoo.com wrote:
Hello everyone, I would
Hi Milton,
Thanks for trying to help anyway.
From: milton ruser milton.ru...@gmail.com
Cc: r-help@r-project.org
Sent: Thursday, August 27, 2009 6:48:41 PM
Subject: Re: [R] subset of a matrix
Hi Carlos,
I think I made a wrong suggestion. Sorry about
script? Can you explain what for
are you using those commands?
Thanks for the help anyway.
Cheers,
Carlos
From: Henrique Dallazuanna www...@gmail.com
Cc: r-help@r-project.org
Sent: Thursday, August 27, 2009 7:00:45 PM
Subject: Re: [R] subset of a matrix
Try
8 matches
Mail list logo