Re: [R] Print data frame as list including row/column name

2010-01-08 Thread Henrique Dallazuanna
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 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

Re: [R] Print data frame as list including row/column name

2010-01-07 Thread Dennis Murphy
Let x be your dataset below. It's assumed that R1-R4 are the row names of the data frame, so we create a variable to get them into the dataset: x$row <- row.names(x) # Load the reshape package: library(reshape) xx <- melt(x, .id = 'row') # Write to a csv file sans header and row IDs: (assuming

Re: [R] Print data frame as list including row/column name

2010-01-07 Thread jim holtman
how about something like this: > x C1 C2 C3 R1 0 0 1 R2 1 0 0 R3 0 0 0 R4 0 1 0 > z <- stack(x) > z values ind 1 0 C1 2 1 C1 3 0 C1 4 0 C1 5 0 C2 6 0 C2 7 0 C2 8 1 C2 9 1 C3 10 0 C3 11 0 C3 12 0 C3 >