logo
down
shadow

How to keep all rows of a table on the same page in RMarkdown when rendering a PDF file?


How to keep all rows of a table on the same page in RMarkdown when rendering a PDF file?

By : user2952016
Date : November 18 2020, 03:49 PM
seems to work fine As was suggested in the comments, the problem is that the default LaTeX template for pandoc uses longtable (normal LaTeX tables don't split over pages). If you don't feel up to creating your own template, you can just modify the default.
Vanilla Pandoc
code :
pandoc --print-default-template=latex
pandoc --print-default-template=latex | sed 's/longtable,//' > mytemplate.tex
output file: rmarkdown.knit.md

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc rmarkdown.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output rmarkdown.pdf --template /Library/Frameworks/R.framework/Versions/3.0/Resources/library/rmarkdown/rmd/latex/default.tex --highlight-style tango --latex-engine /usr/texbin/pdflatex --variable 'geometry:margin=1in' 

Output created: rmarkdown.pdf
---
title       : "Table"
pandoc_args : --filter path/to/filter.py
output      : 
    pdf_document
---


Share : facebook icon twitter icon
How can I use kable or any other table package as default in Rmarkdown rendering

How can I use kable or any other table package as default in Rmarkdown rendering


By : Romain Chabrier-Jour
Date : March 29 2020, 07:55 AM
wish of those help It depends on your output format (which you didn't mention). For example, for html_document, there is a df_print option, and you can set it to kable.
Rendering kableExtra table with colors and unicode characters to PDF with RMarkdown

Rendering kableExtra table with colors and unicode characters to PDF with RMarkdown


By : George
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I recently learned how to make awesome tables with kableExtra that included unicode symbols, so that they could work as interpretive tables for my plots. , There are a few problems.
code :
  table_info <- data.frame(Symbol=c("$\\bullet$", "$\\bullet$", "$\\blacktriangle$"),
                       Name=c("Name1", "Name2", "Name3"),
                       Description=c("Description1", "Description2",
                                     "Description3"),
                       Results=c("Bad", "Good", "Bad"),
                       Color=c("#ffde71", "#394f38",
                               "#09a2dd"))

  ktable <- table_info %>%
    mutate(Symbol = cell_spec(Symbol, color = Color, format = "latex", 
                              escape = FALSE)) %>%
    select(-Color) %>%
    kable(escape = FALSE, align = c("c", "l", "l"), booktabs = TRUE) %>%
    kable_styling(full_width = FALSE)

  ktable
shinyApp not rendering Rmarkdown file as RStudio

shinyApp not rendering Rmarkdown file as RStudio


By : Charles
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You can try to mimic the function rmarkdown::run by changing the app.R as below.
code :
library(shiny)

file <- 'example.Rmd'
dir <- dirname(file)

ui <- rmarkdown:::rmarkdown_shiny_ui(dir, file)
render_args <- list()
render_args$envir <- parent.frame()
server <- rmarkdown:::rmarkdown_shiny_server(dir, file, 'UTF-8', T, render_args)

shinyApp(ui, server)
How to separate Title Page and Table of Content Page from knitr rmarkdown PDF?

How to separate Title Page and Table of Content Page from knitr rmarkdown PDF?


By : Jack
Date : March 29 2020, 07:55 AM
it fixes the issue Anyone have any idea how to separate Title Page and Table of Content page? From this code: , I used a trifecta of latex files in the options under includes:
Rendering Table with conditional color in latex as a pdf document with rownames = TRUE (rmarkdown, kable and kableExtra

Rendering Table with conditional color in latex as a pdf document with rownames = TRUE (rmarkdown, kable and kableExtra


By : Jacque Turner
Date : March 29 2020, 07:55 AM
like below fixes the issue This is caused by the duplicated rows in the dataframe, as both rows 1 and 2 are the same.
Reviewing the code for row_spec_latex, when kableExtra is used against a kable table, it checks for duplicated rows. If it finds one, it inserts the vphantom argument within the fix_duplicated_rows_latex internal function. This vphantom insertion is then messing up the formatting of the textbf function.
code :
---
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)

library(knitr)
library(kableExtra)
temp <- mtcars[1:5,1:5]
```

```{r}
# Keeping the row names (means all rows are unique)
kable(temp, format = "latex", booktabs = F)  %>%
  kable_styling(position = "center") %>%
  row_spec(1, bold = T, color = "red")
```

```{r}
# Highlighting second row (which doesn't have the vphantom statement)
kable(temp, format = "latex", booktabs = F, row.names=F)  %>%
  kable_styling(position = "center") %>%
  row_spec(2, bold = T, color = "red")
```
Related Posts Related Posts :
  • How can I get my points to connect in a plot and show a trend with NA values in data?
  • Read SPecific lines of a CSV file in R-language
  • ggplot stacked bar plot from 2 separate data frames
  • auto.arima not parallelizing
  • Histogram of binned data frame in R
  • R rewriting stringmanipulations implemented in loop to the R-way
  • get first entries in rows of list?
  • Conditionally removing rows from a matrix in R
  • Using a loop to find P(-1.5<Y<1.5) for a range of sample sizes
  • R-Count and list the maximum count row by row
  • Include Iverson Bracket in R documentation
  • update a data frame and environment in R
  • How to write dynamic cumulative multiple in R
  • format time using as.POSIX in R
  • Change the class of multiple columns
  • Remove period and spaces within column headings nested in a list of data frames
  • R: error message --- package error: "functionName" not resolved from current namespace
  • labels with geom_text ggplot2
  • Passing mongodb ISODate in R
  • Importing "csv" file with multiple-character separator to R?
  • Change row names of a table obtained from a lm regression using xtable function
  • R language iterate over R object
  • How do you delete the header in a dataframe?
  • Re coding in R using complicated statement
  • accumulating functions and closures in R
  • How do you combine two columns into a new column in a dataframe made of two or more different csv files?
  • Twitter authentication fails
  • Summing Values of One Vector Conditional on Values of Another Vector
  • draw cube into 3D scatterplot in RGL
  • lme4 translate formula to code in 3-level model
  • How to draw single axis plot in R
  • Combine geom_tile() and facet_grid/facet_wrap and remove space between tiles (ggplot2)
  • Use snpStats with R version 3.0.1
  • Makefile gives strange error while compiling markdown file into .docx file
  • How to determine whether a points lies in an ellipse
  • Summarize data already grouped in r
  • Is the bigvis package for R not available for R version 3.0.1?
  • Operator overloading in R reference classes
  • How to enable user to switch between ggplot2 and gVis graphs in R Shiny?
  • Is there an easy way to separate categorical vs continuous variables into two dataset in R
  • Correct previous year by id within R
  • Installation of rdyncall package for R
  • ggplot2 plot that evaluates the percentage and mean of a third variable at intersecting points
  • Error Handling with Lapply
  • data.table - split multiple columns
  • How to compute the overall mean for several files in R?
  • R: Graph Plotting: Subscripts in the legend like LaTeX
  • Restructuring data in R
  • Distance of pointsfrom cluster centers after K means clustering
  • R incorrect value of date function
  • Package "Imports" not loading in R development package
  • r - run a user defined function several times by taking column elements as parameters
  • Create input$selection to subset data AND radiobuttons to choose plot type in Shiny
  • Generate crosstabulations from dataframe of categorical variables in survey
  • Restructure output of R summary function
  • New behavior in data.table? .N / something with `by` (calculate proportion)
  • search certain number vector in R
  • R version doesn't support quartz graphic device - RStudio won't plot
  • Referencing a function parameter in R
  • How to synchronize signals using a cross-correlation and FFT in R?
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org