Questions tagged [r]

R is an open source programming language and software environment for statistical computing and graphics. It is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme.

Filter by
Sorted by
Tagged with
0 votes
1 answer
2k views

How to Integrate R code in TeXStudio?

I am writing my thesis in TeXStudio. One chapter features plots / analysis etc. that I am writing in a markdown in RStudio. Is there a way to kinda "link" the documents so the output from R is ...
  • 1
2 votes
0 answers
677 views

Compilation problem with fontenc-Latex - LaTeX2e problem

Unfortunately, I am experiencing the same issue as reported in Compilation problem fontenc-Latex. I reinstalled my TeX installation and ran tlmgr update, all to no avail. I am using RStudio Version 1....
  • 21
2 votes
1 answer
1k views

Different colours for R input and output using listings

I need to quote some R commands and a few scripts, and sometimes to show the output. I would like that the output had a different colour than the input, but I have no idea how to. A minimal example ...
  • 399
1 vote
1 answer
160 views

Spaces in data.frame in R Sweave

I'm making a table in R Sweave using a data frame, but I don't know how to create spaces between the titles, they come out is separated by points. Is there a command that solves this? with the ...
  • 13
2 votes
1 answer
5k views

How to customize header with Rmarkdown?

I'm currently working on a pdf document using Rmarkdown on RStudio but I'm very much confused about to how to customize my YAML section. This is my actual code: --- title: "The very basics of R" ...
0 votes
0 answers
139 views

Make documents where the date printed on the document is automatically the date of creation of document

Is there a way to create latex documents where the date printed on the documents is always by default the date of creation of the document? I don't want to compile the same latex file 30 days later ...
user avatar
4 votes
0 answers
3k views

How to overcome LaTeX Warning: Command \@footnotemark has changed?

I'm using rmarkdown, and after knitting a document I always receive this warning (the document knits normal, though). Output created: XY.pdf Warning message: LaTeX Warning: Command \@footnotemark ...
  • 413
0 votes
2 answers
1k views

Rmarkdown code style in LaTeX

I would like my R code in latex to look like the rmarkdown block of codes: Distinct colours for functions and grey background. I pasted my code between \begin{markdown} and \end{markdown} But this ...
  • 103
2 votes
3 answers
705 views

How do I transfer output of animation R package on a beamer frame

I have the following R code from animation package that generates a random number which adds random number generated one after the other on display on R terminal. library("animation") brownian.motion(...
2 votes
1 answer
927 views

Can't fit a table in beamer

This is the output of the stargazer package that I did in R. However, I can't make the table fit in my beamer presentation. Here is the code: % Table created by stargazer v.5.2.2 by Marek Hlavac, ...
1 vote
1 answer
57 views

How compile Knitr in TeXnicCenter?

some of you have tried using TeXnicCenter to compile Knitr, well I would use TexStudio but it is heavy again. I appreciate your help error 'Rscript.exe no such file or directory'
  • 357
0 votes
1 answer
633 views

Deploy custom fonts to shinyapps.io for application that produces an R Markdown report

I have a shiny application that produces an R Markdown report in pdf format, so I used also LaTeX to customise it. In my YAML I use the fontspec package to specify a custom font for the whole document ...
  • 115
1 vote
0 answers
455 views

Images are not rendered with bookdown after updating packages

I am using bookdown with RStudio to create a pdf-book. After updating latex-packages with tinytex::tlmgr_update(), images were suddenly not rendered anymore, either with knitr::include_graphics() or \...
  • 171
3 votes
2 answers
178 views

How Can I Get A LaTex Table Generated By R's MonteCarlo Package To Work?

I have been experimenting with the MonteCarlo package in R for a project. After using the maketable function, I was given the following code to generate a LaTex table with the Monte Carlo simulation's ...
4 votes
1 answer
2k views

R Markdown/pandoc: Change how code blocks are converted to LaTeX

I use rmarkdown to generate a pdf file (which uses pandoc, which in turn uses pdflatex). By enabling keep_tex option, I noticed that code blocks without language type always become verbatim, e.g.: ```...
3 votes
5 answers
10k views

Export plots from R directly to Latex

Is there a way to export plots from R directly to latex, more specifically TexStudio? I think exporting/saving the image from R and then importing it to R looses some of the quality. I saw on the ...
2 votes
2 answers
4k views

How can I have a latex type expression as a column name in R?

I am working on many kables using the kableExtra package. Say you have a dataframe,df, that is 5 rows and 5 columns. in R you can do names(df)=c("A","B","C","D","E") for example. Once you have the ...
  • 123
1 vote
1 answer
676 views

R studio cannot make xtable

library(xtable) library(magrittr) library(moonBook) options(ztable.type="html") a=mytable(head(iris)) a x = xtable(a) x i cannot make xtable, just use mytable... want to use xtable, but output like ...
2 votes
2 answers
613 views

Basic R code yields errors of "unclosed $" in knitr

I cannot use R code in Overleaf Knitr, since any basic code which includes $ yields error of unclosed $. Even the sample file of knitr in Overleaf itself causes LaTeX error: https://www.overleaf.com/...
0 votes
1 answer
873 views

Problem when compiling book with bookdown - natbib error

I am creating a pdf-book with bookdown using the following YAML: --- site: bookdown::bookdown_site geometry: "left=4cm,right=3cm,top=3cm,bottom=3cm" subparagraph: true output: bookdown::pdf_book: ...
  • 171
0 votes
3 answers
11k views

How to use R's xtable() to print the output of table() and keep the row and column margin titles? and rotate

I need to generate many small tables from different pairs of vectors like this: (the vectors have names of different lengths) library(xtable) input1 <- c(0,0,0,1,1,1,1,2,2,2,2) input2 <- c(0,...
  • 958
0 votes
2 answers
314 views

Bookdown bibliography with natbib omits URL for web pages

I am creating a pdf-book using bookdown, with the citation package natbib in the apalike style. I get my citations from a .bib file created by mendeley. I create my citations like this: [@citation]. ...
  • 171
2 votes
1 answer
60 views

The following character ``[`` isn't working in table, error : ! Paragraph ended before \CT@rowd was complete. \par

I'll ask my question here since I think it has more to do with LaTeX than stackoverflow. I am using R Markdown with LaTeX to create pdf documents that shows some tables. Using the R language with ...
  • 123
3 votes
1 answer
546 views

How can I get Rchunks to render inside tcolorbox?

I've created a reprex to show my problem, but I am having this same issue in a custom Rmd template I am crafting. I would like to be able to include stylized code chunks and plot outputs inside of ...
  • 207
0 votes
0 answers
185 views

Including R code in latex

I have some problems by inverting my R code into latex and than copying the code of the pdf back into R. I used lstlistning to read the R code and since it did not show the -, I used this code: \...
  • 1
2 votes
1 answer
284 views

Why can't I center my table using xtable and lualatex in rmd

Can anyone help me solving my issue with xtable, please ? I create a table using xtable, based on data that I processed Rstudio. The main R code runs a Rmd script who generates a pdf with that table....
  • 23
1 vote
1 answer
999 views

Is there a latex package for working with Rtex files locally

Working with Overleaf using .Rtex files and I love it. However, I just discovered that Overleaf does not support a lot of the R packages (e.g., tidyverse, sqldf) and does not work with large data sets....
  • 25
0 votes
0 answers
6k views

How to add cover pages to rmarkdown pdf file?

I need to add a coverpage at the very begginning and end of a pdf document i have made using R Markdown. (My first time using R markdown and latex) As it is now, the first page of the file output is ...
  • 1
0 votes
0 answers
413 views

Accessing variable in inline expression (rmd to pdf output)

I'm working on coding a reproducible rmd which will output a pdf document. I know that for an inline expression to work, it requires $ $ to be placed around it but is there a way around this? Client &...
1 vote
1 answer
416 views

How to avoid the extension files when I compile pdf on r sweave

I face a problem when I compile pdf file I got many files in the working directory, for example, the files Untitled.tex and Untitled.toc along which my files Untitled.pdf and Untitled.Rnw. Can anyone ...
2 votes
1 answer
2k views

Embedding R (kable) results in LaTeX

Apology at first if this question has been asked or the sample is not reproducible. I'm totally new to LaTex and happy to take any advice. I am working on my thesis on a .tex LaTex template given by ...
1 vote
1 answer
2k views

Math symbol in Rmarkdown list

I am trying to get the following code to render correctly in rmarkdown, but unfortunately math mode does not seem to work in a list setting? Can anyone help with this? --- title: "Trial" author: "Jon"...
  • 111
2 votes
2 answers
1k views

How to make Manual references appear in bibliography (citing R)

I would like to cite R in my bibliography. However I'm having trouble getting it to appear. Here my mini.bib files contains @Book{, author = {Hadley Wickham}, title = {ggplot2: Elegant Graphics ...
2 votes
1 answer
184 views

Manual bibliography in knitR with \bibitem{} works but cannot use \cite{} with it

I am trying to use a manual/embedded bibiography in a knitR/LaTeX document (long story short but for various reasons I don't want to be using a seperate .bib file because this script will be used many ...
  • 153
2 votes
2 answers
1k views

How to use \sexpr{} with variable that has "_" in it (i.e. avoid "math mode" error)

I am using knitr in R to write up a document in LaTex. Below a certain of code, I would like to refer to a variable I used in R. <<chunk>> var <- "ENSEMBL_MART_ENSEMBL" @ In this ...
  • 153
2 votes
1 answer
1k views

Can't remove italic format from my text with either \normalfont or \textnormal

$$\textit{Some italic and {\normalfont non italic} text}$$ $$\textit{Some italic and \textnormal{non italic} text}$$ My LaTeX block above is supposed to generate text like this (the first line): But ...
2 votes
1 answer
3k views

Ubuntu 18.04 LTS Texlive 2018 ! LaTeX Error: File `ulem.sty' not found

After installing tinytex R package, I started getting LaTeX error regarding missing .sty files. One such error is LaTeX Error: File `ulem.sty' not found. I used the following code Checked Texlive ...
  • 8,443
2 votes
1 answer
166 views

Class tufte-book and R listings code box width problem

When I run the following MWE: \documentclass{tufte-book} \usepackage{Sweavel} \usepackage{amsthm} \usepackage{mathtools} \usepackage{soul} %%%%%%%%%% % R example %%%%%%%%%% \newtheoremstyle{rex}{}{...
  • 289
1 vote
1 answer
3k views

Disabling page numbering bottom of page

Newbie question here. I seem to have some trouble changing the page numbering. I want it in the header, instead of the bottom of the page. I got the header working, but I have been deleting and ...
  • 27
3 votes
1 answer
503 views

Tikz .tex file for a ggplot image made in R won't render as pdf in my tex document (but no compile error!)

I'll preface by saying that I'm not sure whether this is better off posted in StackOverflow, and I'd be happy to move it over there if that turns out to be the case. tl;dr I followed the ...
  • 215
2 votes
2 answers
233 views

Environment undefined ONLY when referencing a preamble.tex

I'm trying to use R Markdown to typeset some notes and I'm having difficulty using the \adjustwidth environment. The issue only arises when I reference some preamble.tex. For instance, if I have a ...
  • 131
3 votes
1 answer
2k views

How to add page numbers to inline references using csl in rmarkdown?

I am using RMarkdown in RStudio to reference multiple sources out of my .bib file with csl (see below). My .Rmd doc: --- title: "mytitle" author: "nunberg" date: '01\.01\.2019' output: ...
2 votes
1 answer
661 views

How to cite german book titles properly (upper case) with csl and rmarkdown?

I am using RMarkdown in RStudio and want to cite several sources using csl, specifically I use the style "elsevier-with-titles.csl". I want to cite a german reference, so title must have upper case ...
0 votes
0 answers
1k views

Having problems with LaTeX coding in Rmarkdown (fancyhdr, \headheight)

I'm currently having an issue with latex in Rmarkdown (using fancyhdr package). I am trying to make a data report with a certain template style. This is a screenshot of the pdf at its current stage ...
  • 1
2 votes
1 answer
2k views

How to center and flush right cells in a column

I am trying to create a table with a numeric column number which I wish to center and flushright content as follows: Using RMarkdown, I am only able to wrap LaTeX code around/inline with cell content ...
  • 135
3 votes
2 answers
2k views

Reporting R Results in LaTeX

I´m writing my thesis in LaTeX (using Overleaf) and I analyzed some data in R. So I have a R script where I perform a bunch of tests and regressions. Now I want to e.g. include the t-statistic and p-...
  • 45
1 vote
3 answers
11k views

Can I type \LaTeX inside inline code in Rmarkdown?

I know I can use $$ to write \LaTeX in Rmarkdown documents like $\beta$. My goal is if this is possible inside inline code. I would do `$\beta$` or `$\\beta$`, but both do not work. In case it is ...
  • 887
1 vote
1 answer
2k views

Importing entire R Script file into Latex

Is there a way to import an entire RScript (.R) file into Latex directly without manually using listings and copying the code into Latex?
  • 155
0 votes
1 answer
2k views

R Markdown preview LaTeX by scrolling over

I believe in the past I have been able to preview my LaTeX code in R Markdown by just placing the cursor over the LaTeX chunk, but right now I'm unable to recreate that. Any idea how to turn that back ...
  • 131
0 votes
2 answers
369 views

Table of contents in Beamer R Studio

i'am trying to generate an beamer presentation but i can't add an Ouline of my document: this is my code: --- title: 'PEC-3 Gestión Económico-Financiera: Casos de Negocio. El sector de la ...

1 2
3
4 5
12