0

I would like to print this ftable with tableGrob.

tab=ftable(data, row.vars = c("Sales.Year","Return"),col.vars="Category")

And i'd also like to add margins. How can i do?

Phil
  • 7,287
  • 3
  • 36
  • 66
  • Hi Marco, good first question, but I think it needs some more details: 1) can you format your code with the backticks like in markdown? (think RNotebook code chunks) 2) What is data? Can you make a _reproducible_ example we can understand with something like `iris` which is a data set built into R 3) can you explain more about why you want to print with `tableGrob`? `ftable` already has a print method (as seen here: https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/ftable) – DaveRGP Mar 26 '20 at 15:40
  • Hi, i've used tableGrob to print a several number of table yet, so i'd like to continue with this method. tab=ftable(data, row.vars = c("Sales.Year","Return"),col.vars="Category") Return is a dicotomic variable with value 0 and 1. Category is a categorical variable. I don't know how to insert the table that I'd want as an example. – marco21 Mar 26 '20 at 17:20
  • Category 0 OTH PFA PFD PFF PFM PFS PFT Sales.Year Authorized.to.return 2015 0 28 9 10337 39 132 41800 1111 0 1 0 0 599 0 24 867 186 0 2016 0 0 3 11372 44 245 45000 2631 0 1 0 0 464 0 66 590 153 0 – marco21 Mar 26 '20 at 17:20
  • Ok, but I don't think you need `tableGrob` here, so you are making life more difficult for yourself. when you say "print" do you mean to the R session as text, or somewhere else? Also, please _edit_ your answer with the changes, and delete the comments, then we can keep things tidy and clear :) – DaveRGP Mar 28 '20 at 12:30

0 Answers0