[R] Knitr: setting echo = FALSE globally

Rich Shepard rshepard at appl-ecosys.com
Mon Jul 20 21:58:51 CEST 2015


On Mon, 20 Jul 2015, Thierry Onkelinx wrote:

> We need the source file.

   Attached to the original message was the TeX output called, 'sample.txt'.
I've attached it again, but with the .tex extension. Also, the .lyx file is
attached.

Rich
-------------- next part --------------
#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass scrreprt
\begin_preamble
\date{}
\usepackage{textcomp,url,multicol}
%\setkomafont{sectioning}{\rmfamily}
\end_preamble
\options abstract=on
\use_default_options false
\begin_modules
natbibapa
knitr
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman palatino
\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 0
\bibtex_command bibtex
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize letterpaper
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 0
\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 authoryear
\biblio_style humannat
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 2
\tocdepth 2
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 2
\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 Standard
In 1986 Ward described the status of water quality assessment as "data rich
 and information poor" 
\begin_inset CommandInset citation
LatexCommand citep
key "Ward1986"

\end_inset

.
 The authors addressed the lack of science-based design of monitoring location
 networks; this situation still applies.
 They defined water quality monitoring as "any effort by a government or
 private enterprise to obtain an understanding of the physical, chemical,
 and biological characteristics of water via statistical sampling." Of course,
 their definition also applies to appropriate statistical analyses of the
 collected data.
\end_layout

\begin_layout Standard
\begin_inset Flex Chunk
status open

\begin_layout Plain Layout

\begin_inset Argument 1
status open

\begin_layout Plain Layout
opts_chunk$set(echo = FALSE)
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset Flex Chunk
status collapsed

\begin_layout Plain Layout

load('.RData')
\begin_inset Argument 1
status collapsed

\begin_layout Plain Layout
tidy=T, tidy.opts=list(width.cutoff=60)
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
The data available for the Carlin site (USGS station number 10321000 are
 in Appendix A.
 Many documents on data analysis and statistics use small sample sets to
 illustrate the points the author wants the reader to learn.
 Real-world environmental data sets frequently are very large so this document
 uses 52 variables from the total available from the USGS's web site.
\end_layout

\begin_layout Standard
The first step in analyzing water chemistry data for CWA compliance is reading
 it into the analytical software and converting column data types as necessary.
\end_layout

\begin_layout Standard
\begin_inset Flex Chunk
status collapsed

\begin_layout Plain Layout

carlin <- read.csv("./carlin.csv", header=T, sep=",", stringsAsFactors=F)
\end_layout

\begin_layout Plain Layout

carlin$sampdate <- as.Date(carlin$sampdate)
\begin_inset Argument 1
status open

\begin_layout Plain Layout
'input_data'
\end_layout

\end_inset


\end_layout

\end_inset


\end_layout

\begin_layout Standard
Next, check that the data are what you expect to see and convert dates from
 factors.
 The site ID number is retained for use when examining multiple stations
 along the Humboldt River for longitudinal changes and other variables that
 might affect the measured values.
\end_layout

\begin_layout Standard
\begin_inset Flex Chunk
status collapsed

\begin_layout Plain Layout

\begin_inset Argument 1
status collapsed

\begin_layout Plain Layout
'data_set_structure'
\end_layout

\end_inset

str(carlin, width=60, strict.width='cut')
\end_layout

\end_inset


\end_layout

\end_body
\end_document


More information about the R-help mailing list