Skip to content

Instantly share code, notes, and snippets.

@paulrougieux
Last active September 17, 2015 08:17
Show Gist options
  • Save paulrougieux/176c612a355c2249436e to your computer and use it in GitHub Desktop.
Save paulrougieux/176c612a355c2249436e to your computer and use it in GitHub Desktop.
knitr_iris
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage{booktabs}
\end_preamble
\options authoryear
\use_default_options true
\begin_modules
knitr
\end_modules
\maintain_unincluded_children false
\language british
\language_package default
\inputencoding utf8
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 1
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_breaklinks false
\pdf_pdfborder true
\pdf_colorlinks false
\pdf_backref false
\pdf_pdfusetitle false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine natbib
\cite_engine_type numerical
\biblio_style elsarticle-harv
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\branch NoChildDocument
\selected 0
\filename_suffix 0
\color #faf0e6
\end_branch
\branch knitrchunk
\selected 0
\filename_suffix 0
\color #faf0e6
\end_branch
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Title
Generate pdf without the knitr chunks
\end_layout
\begin_layout Section
Introduction
\end_layout
\begin_layout Standard
This is an introductory part which I would like someone else to edit.
The author autor doesn't have access to R and knitr but I would like him
to still be able to generating the pdf document without the tables below.
\end_layout
\begin_layout Section
Descriptive statistics
\end_layout
\begin_layout Subsection
Edgar Anderson's Iris Data
\end_layout
\begin_layout Standard
\lang english
\begin_inset Branch knitrchunk
status open
\begin_layout Standard
\lang english
\begin_inset ERT
status open
\begin_layout Plain Layout
<<iristable, results='asis', echo=FALSE>>=
\end_layout
\begin_layout Plain Layout
library(xtable)
\end_layout
\begin_layout Plain Layout
xtable(head(iris))
\end_layout
\begin_layout Plain Layout
# Print species names
\end_layout
\begin_layout Plain Layout
cat(levels(iris$Species))
\end_layout
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
@
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\lang english
\begin_inset VSpace defskip
\end_inset
\end_layout
\begin_layout Subsection
Speed and Stopping Distances of Cars
\end_layout
\begin_layout Standard
\lang english
\begin_inset Branch knitrchunk
status open
\begin_layout Standard
\lang english
\begin_inset ERT
status open
\begin_layout Plain Layout
<<carsstable, results='asis', echo=FALSE>>=
\end_layout
\begin_layout Plain Layout
library(xtable)
\end_layout
\begin_layout Plain Layout
xtable(head(cars))
\end_layout
\begin_layout Plain Layout
@
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
\lang english
\begin_inset VSpace defskip
\end_inset
\end_layout
\end_body
\end_document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment