% \VignetteIndexEntry{Examples for the qTable function}
% \VignetteKeyword{optimize,heuristics}
\documentclass[a4paper,11pt]{article}
\usepackage[left = 2.5cm, top = 2cm, bottom = 3cm, right = 3.5cm]{geometry}
\usepackage[noae]{Sweave}
\usepackage{mathptmx}
\usepackage{amsmath,amstext}
\usepackage{hyperref}
\usepackage{natbib}
\SweaveOpts{keep.source = TRUE, eps = TRUE, pdf = FALSE}
\usepackage{color}
\definecolor{grau2}{rgb}{.2,.2,.2}
\definecolor{grau7}{rgb}{.7,.7,.7}
% define *Sweave* layout
\DefineVerbatimEnvironment{Sinput}{Verbatim}{}
\DefineVerbatimEnvironment{Soutput}{Verbatim}{frame=single,xleftmargin=0em,%
  formatcom=\color{grau2},rulecolor=\color{grau7}}
\DefineVerbatimEnvironment{Scode}{Verbatim}{xleftmargin=2em}
\fvset{listparameters={\setlength{\topsep}{0pt}}}
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}
<<echo=false>>=
options(continue = " ", digits = 5)
@

\begin{document}
{\raggedright{\LARGE Examples for the \texttt{qTable} function}}\medskip

\noindent Enrico Schumann\\
\noindent \texttt{es@enricoschumann.net}\\
\bigskip


\noindent We attach the package and create some random data.
<<>>=
require("NMOF")
x <- rnorm(100L, mean = 0, sd = 1.5)
y <- rnorm(100L, mean = 1, sd = 1)
z <- rnorm(100L, mean = 1, sd = 0.5)
X <- cbind(x, y, z)
summary(X)
@
A call to \texttt{qTable} could like this, and it will result in the
\LaTeX{} output below.
<<results=tex>>=
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, xmin = -10, xmax = 10, dec = 2))
@

\medskip\medskip

If you use Sweave, use \verb"<<results=tex>>=" to start a code chunk.

\newpage
\section*{Examples}

\small
<<res1,results=tex>>=
## with limits
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, xmin = -10, xmax = 10, dec = 2))
@
\medskip

<<res2,results=tex>>=
## without specified limits
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, dec = 2))
@
\medskip

<<res3,results=tex>>=
## 3 digits
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, dec = 3))
@
\medskip

<<res4,results=tex>>=
## specific labels, but no limits
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           labels = c(-8,2,8), at = c(-8,2,8),
           circlesize = 0.0125, dec = 1))
@
\medskip

<<res5,results=tex>>=
## specific labels and limits, linethickness
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
       labels = c("a","b","c"), at = c(-8,2,8),
       circlesize = 0.02, dec = 1, linethickness = "0.2ex",
       xmin = -10, xmax = 10))
@

<<res6,results=tex>>=
## specific labels and limits, linethickness
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
       labels = c("a","b","c"), at = c(-8,2,8),
       circlesize = 0.02, dec = 1, linethickness = "0.2ex",
       xmin = -10, xmax = 10))
@

<<res7,results=tex>>=
## with limits and alternative functions
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, xmin = -10, xmax = 10, dec = 2,
           funs = list(average = mean, 
                       `10th Q.` = function(x) quantile(x, 0.1),
                       `90th Q.` = function(x) quantile(x, 0.9))))
@
\medskip

<<res8,results=tex>>=
## with limits and without summary stats
cat(qTable(X, yoffset = -0.025, unitlength = "5cm",
           circlesize = 0.0125, xmin = -10, xmax = 10, dec = 2,
           funs = list()))
@
\medskip

\end{document}
