shidaxia at yahoo.com
Fri May 21 07:51:34 CEST 2010
Still not clear. Follow the posting guide and some examples always help.
Not sure how you "concatenate" numbers?
You can try, for example,
apply(df[1:10,], 2, paste, collapse=" ")
but this will turn everything into strings. Is this what you want?
----- Original Message ----
> From: santana sarma <aimanusarma at gmail.com>
> To: David Winsemius <dwinsemius at comcast.net>
> Cc: r-help at r-project.org
> Sent: Thu, May 20, 2010 9:21:33 PM
> Subject: Re: [R] Concatenation
> Hi David,
SORRY - I am trying to be more clearer this time.
> say the dataframe has some rows and columns, with unique rownames and
> names. The rest of the data in the dataframe are just numbers.
I wish to
> concatenate those rows. That means : I wish to concatenate first
> values in one row, then next 20 rows's values in the next row ....
Similarly, for columns : The first 10 column's values will be one
> below the
other ... and so on.
= = = = = = = =
> = = =
On Fri, May 21, 2010 at 3:53 PM, David Winsemius <
> ymailto="mailto:dwinsemius at comcast.net"
> href="mailto:dwinsemius at comcast.net">dwinsemius at comcast.net>wrote:
> On May 20, 2010, at 11:05 PM, santana sarma wrote:
>> I have a dataframe with some 800 rows and 14
>> Could you please advise how I can concatenate
> the rows - one after
>> Similarly for columns, one
> below the other.
> Not sure exactly what you are
> unlist might accomplish the second task.
> Whether c(apply(df, 1, I)) would be satisfactory for the first task
> depend on whether the columns in the dataframe were all of the
> same type.
> Now that I think of it, both soolutions would force the types
> to be that
> df[1:nrow(df), ] ... would essentially give
> you the first request, but
> it would not be any different than just
> typing df. So .... what do intend
> this process to
> David Winsemius, MD
> Hartford, CT
> version deleted]]
> ymailto="mailto:R-help at r-project.org"
> href="mailto:R-help at r-project.org">R-help at r-project.org mailing list
> href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank
PLEASE do read the posting
> guide http://www.R-project.org/posting-guide.html
and provide commented,
> minimal, self-contained, reproducible code.
More information about the R-help