ewenharrison / finalfit

Quickly create elegant regression results tables and plots when modelling in R
https://finalfit.org/
Other
265 stars 29 forks source link

Table format of the finalfit output only gives HTML format script #95

Closed shoaibraees closed 10 months ago

shoaibraees commented 11 months ago

Hi, Can you please help me what is going wrong. The table format only give a very long HTML script (nothing like a proper/normal table). Thanks for a prompt guidance. I share a script here

fit2 = melanoma %>% finalfit(dependent, explanatory, metrics = TRUE) -> t2

knitr::kable(t2[[1]], row.names=FALSE, align=c("l", "l", "r", "r", "r", "r")) knitr::kable(t2[[2]], row.names=FALSE, col.names="")

ewenharrison commented 11 months ago

You need to run this within an R Markdown or Quarto file, as per here: https://finalfit.org/articles/export.html

shoaibraees commented 10 months ago

Thanks for this input. Is it possible to get similar nice tables in R consoles? Appreciate it if you could share a modified script that can be adapted while using the finalfit commands. We tried other options but nothing produces a table so nicely as you are doing using the R markdown.

riinuots commented 10 months ago

Hi,

Happy to help, but can you provide a bit more detail about your current workflow? Would you like the table to be printed in the console? Where would it go from there (what format of output file/presentation)? This will enable us to suggest workarounds. I'd also like to note that it is possible to knit/render RMarkdown or Quarto document via the command line, if that's the workflow issue here.

Best wishes, Riinu

riinuots commented 10 months ago

The HTML code is added by the kable() function, perhaps what you need is to call the tables on their own like this?

t2[[1]]
t2[[2]]
Screenshot 2023-11-29 at 12 24 34