[R] Tables, knitr markdown
Duncan Murdoch
murdoch.duncan at gmail.com
Mon Feb 22 22:55:36 CET 2016
On 22/02/2016 3:46 PM, Santosh wrote:
> Just figured out..
>
> as.data.frame(as.matrix(<tabular_object>),stringsAsFactors=F)
>
> could work! :)
Why do you want to produce Markdown output? the tables package
(lowercase t!) can produce output in either LaTeX or HTML. Just tell
knitr to leave the output alone, e.g. for PDF output
```{r results="asis"}
require(tables)
tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)*
(Sepal.Length + Sepal.Width)*(mean + sd), data=iris )
latex(tab)
```
or for HTML output
```{r results="asis"}
require(tables)
tab <- tabular( (Species + 1) ~ (n=1) + Format(digits=2)*
(Sepal.Length + Sepal.Width)*(mean + sd), data=iris )
html(tab)
```
Duncan Murdoch
>
>
> On Mon, Feb 22, 2016 at 12:17 PM, Santosh <santosh2005 at gmail.com> wrote:
>
>> Dear Rxperts..
>> I am able to generate tables using Tables R package..
>> However, when I have been unsuccessful in using kable (from knitr package)
>> to generate the table in R markdown script..
>>
>> It's because the output generated by "tabular" in Tables package is of
>> class "tabular". The kable function in knitr package accepts data.frame.
>>
>> Is there a way to convert the tabular class objects into data.frame
>> objects?
>>
>> Or is there a way that kable can accept "tabular" class object?
>>
>>
>> Thanks so much..
>> Santosh
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
More information about the R-help
mailing list