Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-05-02 Thread Bert Gunter
Don't know if this would help, but you could always set an attribute of alphatab to be the dimnames. See ?attrib . Of course you would then have to write a custom print() function, possibly along the lines you indicated. You could also do this via S3 (or whatever) classes, of course. But again,

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-05-02 Thread Jim Lemon
Hi jpm miao, After a fair stretch of fooling around with it, I can't see any way to add the variable names ("varnames") to the output of delim.table without breaking it for things other than table objects. You can probably do this as a one-off hack by setting the names of the dimnames of the

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread jpm miao
Thanks. Could we print the row/column names, "alpha1" and "alpha2" to the csv file? 2016-04-30 17:06 GMT-07:00 Jim Lemon : > Hi jpm miao, > I think you can get what you want like this: > > alpha1<-sample(LETTERS[1:3],50,TRUE) > alpha2<-sample(LETTERS[1:2],50,TRUE) >

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread Jim Lemon
Hi jpm miao, I think you can get what you want like this: alpha1<-sample(LETTERS[1:3],50,TRUE) alpha2<-sample(LETTERS[1:2],50,TRUE) alphas<-data.frame(alpha1,alpha2) library(prettyR) alphatab<-xtab(alpha1~alpha2,alphas) sink("temp_table3.csv",append=TRUE) delim.xtab(alphatab,pct=NA,delim=",")

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread jpm miao
Jim, Thanks for creating such a fantastic package "prettyR". I want to print the pretty frequency table (with row total and column total) to an excel (or csv ) file. Is it possible? >alphatab A B Total A 8 10 18 B 7 5 12 C 9 11 20 Total 24 26 50 Two issues I encountered (See the

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-26 Thread Jim Lemon
Hi jpm miao, You can get CSV files that can be imported into Excel like this: library(prettyR) sink("excel_table1.csv") delim.table(table(df[,c("y","z")])) sink() sink("excel_table2.csv") delim.table(as.data.frame(table(df[,c("y","z")])),label="") sink() sink("excel_table3.csv")