r - Not showing NAs in knitr::kable output as do xtable -


this question has answer here:

i want omit nas in output of knitr::kable output same xtable (see kable , xtable outputs below). highly appreciated. thanks

fm12anova <-   structure(list(sov = c("days", "residuals"), df2 = c(1l, 178l   ), sum.sq2 = c(162702.651909532, 405251.617480465), mean.sq2 = c(162702.651909532,    2276.69448022733), f.value2 = c(71.4644205986244, na), pr..f.2 = c(9.89409632221545e-15,    na), sum.sq1 = c(30031.0139578738, na), mean.sq1 = c(30031.0139578738,    na), numdf1 = c(1l, na), dendf1 = c(17.0000010028433, na), f.value1 = c(45.8530037127448,    na), pr..f.1 = c(3.26378804516025e-06, na)), class = "data.frame", row.names = c(na,    -2l), .names = c("sov", "df2", "sum.sq2", "mean.sq2", "f.value2",    "pr..f.2", "sum.sq1", "mean.sq1", "numdf1", "dendf1", "f.value1",    "pr..f.1"))  library(knitr) kable(fm12anova)   |sov       | df2|  sum.sq2|   mean.sq2| f.value2| pr..f.2|  sum.sq1| mean.sq1| numdf1| dendf1| f.value1| pr..f.1| |:---------|---:|--------:|----------:|--------:|-------:|--------:|--------:|------:|------:|--------:|-------:| |days      |   1| 162702.7| 162702.652| 71.46442|       0| 30031.01| 30031.01|      1|     17|   45.853| 3.3e-06| |residuals | 178| 405251.6|   2276.694|       na|      na|       na|       na|     na|     na|       na|      na|  library(xtable) xtable(fm12anova) % latex table generated in r 3.4.1 xtable 1.8-2 package % sun sep 10 16:46:42 2017 \begin{table}[ht] \centering \begin{tabular}{rlrrrrrrrrrrr}   \hline  & sov & df2 & sum.sq2 & mean.sq2 & f.value2 & pr..f.2 & sum.sq1 & mean.sq1 & numdf1 & dendf1 & f.value1 & pr..f.1 \\    \hline 1 & days &   1 & 162702.65 & 162702.65 & 71.46 & 0.00 & 30031.01 & 30031.01 &   1 & 17.00 & 45.85 & 0.00 \\    2 & residuals & 178 & 405251.62 & 2276.69 &  &  &  &  &  &  &  &  \\     \hline \end{tabular} \end{table} 

check out answer svannoy on hiding na's when printing dataframe in knitr

```{r echo=false, results='asis'} options(knitr.kable.na = '') knitr::kable(lowertri, digits=2) 

```

(tried mark possible dupe, i'm noob.)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -