Skip to content
Back to formatted view

Raw Message

Message-ID: <da79af331001080311l5b2c4587od166e91f10e71b26@mail.gmail.com>
Date: 2010-01-08T11:11:14Z
From: Henrique Dallazuanna
Subject: Print data frame as list including row/column name
In-Reply-To: <1262916209013-1009409.post@n4.nabble.com>

Try this:

 writeLines(do.call(paste, c(as.data.frame.table(as.matrix(x)), sep = ";")))

On Fri, Jan 8, 2010 at 12:03 AM, sugimoto <ieyasu at sugimoto.at> wrote:
>
> Hi all,
>
> I have the following problem:
> I have a data frame (actually it is a prop.table) which I want to print as a
> list, e.g.:
> ? ? ? ? ?C1 ?C2 ?C3
> ?R1 ?0.0 ?0.0 ?1.0
> ?R2 ?1.0 ?0.0 ?0.0
> ?R3 ?0.0 ?0.0 ?0.0
> ?R4 ?0.0 ?1.0 ?0.0
>
> should be printed like
> C1;R1;0.0
> C2;R1;0.0
> C3;R1;1.0
> C1;R2;1.0
> C2;R2;0.0
> .....
>
> Is there any existing solution out there or could somebody please give me a
> hint on how to solve the problem?
>
> Many thanks in advance,
> I. Sugimoto
> --
> View this message in context: http://n4.nabble.com/Print-data-frame-as-list-including-row-column-name-tp1009409p1009409.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paran?-Brasil
25? 25' 40" S 49? 16' 22" O