On Thu, 2007-03-29 at 02:12 -0700, A Ezhil wrote:
> Hi All,
>
> Thank you very much for all your suggestions. It's a
> great learning for me. All the three suggested
> solutions seem working. I don't know what 'side
> effects' that you were talking about.
As Peter noted, the phrase 'side effect'
Hi All,
Thank you very much for all your suggestions. It's a
great learning for me. All the three suggested
solutions seem working. I don't know what 'side
effects' that you were talking about. To summarize the
responses:
> s <- read.table("sample.txt", sep="\t")
> s1 <- as.matrix(s)
> s1
V1
Marc Schwartz <[EMAIL PROTECTED]> writes:
> On Wed, 2007-03-28 at 19:55 -0200, Alberto Monteiro wrote:
>> Prof Brian Ripley wrote:
>> >
>> > We have already seen three solutions.
>> >
>> > I don't like to see the use of c() for its side effects. In this
>> > case Marc's as.vector seems to me to
Prof Brian Ripley wrote:
>
> We have already seen three solutions.
>
> I don't like to see the use of c() for its side effects. In this
> case Marc's as.vector seems to me to be self-explanatory, and that
> is a virtue in programming that is too often undervalued.
>
I agree; but for our enligh
On Wed, 2007-03-28 at 19:55 -0200, Alberto Monteiro wrote:
> Prof Brian Ripley wrote:
> >
> > We have already seen three solutions.
> >
> > I don't like to see the use of c() for its side effects. In this
> > case Marc's as.vector seems to me to be self-explanatory, and that
> > is a virtue in
Is this something like what you want?
ab <- rep(1,4)
bb <- rep(2,4)
cc <- rep(3,4)
mydata <- data.frame(ab,bb,cc)
unlist(mydata)
unlist(data.frame(t(mydata)))
--- A Ezhil <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a matrix HR(9x27). I would like to make a
> single vector with elements: t(HR
We have already seen three solutions.
I don't like to see the use of c() for its side effects. In this case
Marc's as.vector seems to me to be self-explanatory, and that is a virtue
in programming that is too often undervalued.
On Wed, 28 Mar 2007, Marc Schwartz wrote:
> On Wed, 2007-03-28 at
A Ezhil wrote:
>
> I have a matrix HR(9x27). I would like to make a
> single vector with elements: t(HR[,1]) followed by
> t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
> way of converting this matrix into a vector rather
> doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
> ..)?
>
On Wed, 2007-03-28 at 10:27 -0700, A Ezhil wrote:
> Hi,
>
> I have a matrix HR(9x27). I would like to make a
> single vector with elements: t(HR[,1]) followed by
> t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
> way of converting this matrix into a vector rather
> doing something like c(t
A matrix is just a vector with a dim attribute, so if you remove
the dim attribute it'll be a vector. The elements of a matrix
are stored columnwise so you'll get just what you want, if i get
your question right.
> g <- matrix(1:6, nc=2, nr=3)
> g
[,1] [,2]
[1,]14
[2,]25
[3,
: Wednesday, March 28, 2007 1:28 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Large matrix into a vector
Hi,
I have a matrix HR(9x27). I would like to make a
single vector with elements: t(HR[,1]) followed by
t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
way of converting this matrix into
Hi,
I have a matrix HR(9x27). I would like to make a
single vector with elements: t(HR[,1]) followed by
t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
way of converting this matrix into a vector rather
doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
..)?
Thanks in Advance.
Kind reg
12 matches
Mail list logo