emacs/layers.personal/misctools/my-polymode/local/polymode/samples/Minimal.rapport
2018-04-07 10:54:04 +08:00

75 lines
1.5 KiB
Plaintext

<!--head
meta:
title: Minimal template
author: Gergely Daróczi
description: This template demonstrates the basic features of rapport. We all hope
you will like it!
packages:
- ggplot2
- xtable
example:
- rapport("Minimal", data = ius2008, var='leisure')
- rapport("Minimal", data = ius2008, var='leisure', desc=FALSE)
- rapport("Minimal", data = ius2008, var='leisure', desc=FALSE, histogram=T)
inputs:
- name: var
label: Variable
description: A variable
class: numeric
length: 1
value: ~
required: TRUE
standalone: FALSE
- name: desc
label: Descriptives
description: Table of the descriptive statistics
class: logical
value: TRUE
required: FALSE
standalone: TRUE
- name: histogram
label: Histogram
description: Histogram
class: logical
value: FALSE
required: FALSE
standalone: TRUE
head-->
# Début
Hello, world!
I have just specified a *Variable* in this template named to **<%=rp.name(var)%>**. The label of this *variable* is "<%=var.label%>".
And wow, the mean of *<%=var.name%>* is <%=mean(na.omit(var))%>!
<%=
if (!desc) '**For more detailed statistics, you should have set `desc=TRUE`!**'
%>
<% if (desc) { %>
## 'Descriptive statistics'
<% } %>
<%=
if (desc) summary(var)
%>
<%=
if (desc) sprintf('The 5 highest value are: %s.', p(sort(var, decreasing = TRUE)[1:5]))
%>
<% if (histogram) { %>
## 'Histogram'
<% } %>
<%=
if (histogram)
if (require(lattice)) {
histogram(rp.data[, var.name])
} else
hist(rp.data[, var.name])
%>