Skip to content

Commit

Permalink
update paper with error
Browse files Browse the repository at this point in the history
  • Loading branch information
huizezhang-sherry committed Apr 19, 2024
1 parent 3950d84 commit 394ad6d
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 194 deletions.
32 changes: 32 additions & 0 deletions inst/paper-with-errors/RJwrapper.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}

\usepackage{longtable}

% Always define CSL refs as bib entries are contained in separate doc
% Pandoc citation processing
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newlength{\cslentryspacingunit} % times entry-spacing
\setlength{\cslentryspacingunit}{\parskip}
% for Pandoc 2.8 to 2.10.1
\newenvironment{cslreferences}%
{}%
{\par}
% For Pandoc 2.11+
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\let\oldpar\par
\def\par{\hangindent=\cslhangindent\oldpar}
\fi
% set entry spacing
\setlength{\parskip}{#2\cslentryspacingunit}
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}



Expand Down
37 changes: 37 additions & 0 deletions inst/paper-with-errors/paper-with-errors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by `rjournal_pdf_article()` using `knitr::purl()`: do not edit by hand
# Please edit paper-with-errors.Rmd to modify this file

## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library(plotly)
library(ggplot2)
library(palmerpenguins)


## ----penguins-alison, out.width = "100%", out.height = "30%", fig.cap = "Artwork by \\@allison\\_horst"----
knitr::include_graphics("penguins.png")


## ----penguins-tab-interactive, eval = knitr::is_html_output(), layout = "l-body-outset"----
#> knitr::kable(head(penguins), format = "html", caption = "A basic table")


## ----penguins-tab-static, eval = knitr::is_latex_output()---------------------
knitr::kable(head(penguins), format = "latex", caption = "A basic table") %>%
kableExtra::kable_styling(font_size = 7)


## ----penguins-plotly, echo = TRUE, fig.height = 5, fig.cap="A basic interactive plot made with the plotly package on palmer penguin data. Three species of penguins are plotted with bill depth on the x-axis and bill length on the y-axis. When hovering on a point, a tooltip will show the exact value of the bill depth and length for that point, along with the species name.", include=knitr::is_html_output(), eval=knitr::is_html_output()----
#> p <- penguins %>%
#> ggplot(aes(x = bill_depth_mm, y = bill_length_mm,
#> color = species)) +
#> geom_point()
#> ggplotly(p)


## ----penguins-ggplot, echo = TRUE, fig.height = 5, fig.cap="A basic non-interactive plot made with the ggplot2 package on palmer penguin data. Three species of penguins are plotted with bill depth on the x-axis and bill length on the y-axis. Visit the online article to access the interactive version made with the plotly package.", include=knitr::is_latex_output(), eval=knitr::is_latex_output()----
penguins %>%
ggplot(aes(x = bill_depth_mm, y = bill_length_mm,
color = species)) +
geom_point()

Loading

0 comments on commit 394ad6d

Please sign in to comment.