r-markdown

R Notebook HTML Format - add hyperlinks to paged table

雨燕双飞 提交于 2019-12-02 04:59:52
I wish to knit an html file from an R Notebook that contains paged tables with hyperlinks. Hyperlinks can be inserted using knitr::kable , but I can't find a way to generate a paged table with this function. Paged tables are the default notebook output, but I can't find a way of inserting functional hyperlinks . Many thanks for your help. --- title: "Paged notebook table with hyperlinks" output: html_notebook: code_folding: "hide" --- ```{r rows.print=3} wiki.url <- "https://en.wikipedia.org/wiki/" df1 <- data.frame(Month=month.name, URL=paste0("[", month.name, "](", wiki.url, month.name, ")")

Why does {.tabset} not work with htmltools::tagList?

瘦欲@ 提交于 2019-12-02 04:04:48
The content looks fine except that there are "normal" sections without tabs. What I also tried: Use cat(paste0("### Number ", i, "{.tabset}\n")) instead of htmltools::h3(...) Look for a possible parameter tabset = TRUE in htmltools::h3 Minimal reproducible example: --- title: "Test" author: "SQC" date: "11 Juli 2019" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = FALSE) library(leaflet) ranges <- paste0("section_", c(1:3)) ``` # Title level 1 ```{r, echo=FALSE, results='hide'} html <- list() for (i in 2:3) { html <- c(html, list(htmltools::h3(paste0("Number

Table spacing issue converting to PDF via LaTeX with pandoc

我的梦境 提交于 2019-12-02 04:04:36
I'm facing the issue that in R texreg() doesn't seem to break the lines in the notes below the table. Also the margins between the models are not extended equally like it's happening with htmlreg() which gives a clean result. Manual breaks like \n or HTML tags are not working with 'texreg'. There's a partly workaround from MichaelChirico , but one has to change the texreg() function but it seems the method doesn't respect the case when we're dealing with more than one model side by side. Here is the code I'm using: --- title: "Untitled" author: "jaySf" date: "13 Juni 2017" output: pdf_document

Table of multiple lm() models using apsrtable in Rmarkdown

早过忘川 提交于 2019-12-02 03:51:08
问题 Goal Present the results of multiple models, created using the lm() function, together in a nicely-formatted table. This table will be generated in a .Rmd file and output to a PDF document. Proposed Solution In Reproducible Research with R and RStudio , there is an example using the apsrtable() function to display multiple models side-by-side. This book provides the following code (p. 173-174): Code \begin{table} \caption{Example Nested Estimates Table with \emph{aprstable}} \label

Producing ggplots from a loop (and generating the files) without printing any visible output in RMarkdown

早过忘川 提交于 2019-12-02 03:45:33
I am building a table with a mixture of numbers, text, and plots. I constructed my plots with ggplot, and added them to the table afterwards (please see code below). Because I will (eventually) have many plots, I need to use a loop to efficiently create them all. However, because ggplot seems to require printing to generate image links for each plot, I am unable to use invisible() , and subsequently get the pesky '[ 1 ] [[2]] [[3]]' output at the top of the image below. How can I compile the document without printing any visible output from ggplot? ```{r score_table, fig.show = "hide", echo =

R Markdown Not Rendering Citation

人走茶凉 提交于 2019-12-02 03:44:29
问题 I am trying to use the bibtex feature of RMarkdown for citations, but my citations are not being rendered. I am using the latest versions of R, RStudio, and RMarkdown. My rmd file looks like this: --- title: "Music Recommender Systems" output: html_document: theme: united toc: yes pdf_document: toc: yes word_document: default bibliography: bibliography.bib --- Blah blah @778431 My bibtex file "bibliography.bib" is saved adjacent to the .rmd file and looks like this: @inproceedings{778431,

Showing code chunk name in output in RMarkdown

杀马特。学长 韩版系。学妹 提交于 2019-12-02 03:43:19
As known in RMarkdown code chunks can be named like this: ```{r chunkname} plot(x,y) ``` Is it possible to showing chunkname in output document? You can use knitr::opts_current$get()$label example: ```{r cars} library(knitr) opts_current$get()$label plot(cars) ``` It will also work outside of a chunk, in an inline r code. It will then output the label of the last chunk. You can of course save the labels in a vector to use them later, for instance with a custom hook: ```{r knitr_setup} library(knitr) ll <- opts_current$get()$label knit_hooks$set(label_list = function(before, options, envir) {

Size of the embeded PDF document in Rmarkdown

一世执手 提交于 2019-12-02 03:34:37
I'm trying to embed a pdf document in a Rmarkdown document generated by KnitR using \includepdf . It works but included documents are very small: The reproducible example below: --- output: pdf_document header-includes: - \usepackage{pdfpages} --- ```{r, echo=FALSE} url = 'https://www.rstudio.com/wp-content/uploads/2015/03/ggplot2-cheatsheet.pdf' download.file(url, 'gg.pdf') ``` \includepdf[pages=-]{gg.pdf} Is there a way to resize the inserted document to its original size? I've found a possible solution but I don't know how to implement it in KnitR: https://tex.stackexchange.com/questions

Rstudio Notebook (rmarkdown) running python: describe not shown

限于喜欢 提交于 2019-12-02 03:23:43
I am runing some python chunks in a Rstudio notebook, which include reading a csv file and printing basic statistics. I could not find the way to print the statistics (describe()) as an output. Here is the code: ```{python, engine.path = '/home/user/anaconda3/bin/python3'} import pandas data_py = pandas.read_csv('/home/user/datafiles/data.csv', sep= ';') ``` ```{python, engine.path = '/home/user/anaconda3/bin/python3'} data_py.describe(include='all') ``` NO output printed. I also tried: ```{python, engine.path = '/home/user/anaconda3/bin/python3'} print(data_py.describe(include='all')) ``` and

Rmarkdown with xelatex

限于喜欢 提交于 2019-12-02 03:11:17
问题 I'm trying to use Calibri font, but from what I understand I first need to be able to use the xelatex engine. This is where I run into problems. Sample code and error are below. Please note that I am very new to latex so chances are I missed something obvious. If it matters I have MikTeX 2.9 installed, and I have successfully generated pdfs using the default pdflatex engine (from what I understand this has very limited fonts.) I'm on windows 10 64 bit. --- header-includes: - \usepackage