You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a number of optional settings that you can control such as: displaying a table of contents, a sample descriptions, changing the title or subtitle, or adding a logo. In this section, we will present each of these.
47
+
There are a number of optional settings that you can control such as: displaying a table of contents, a sample description, changing the title or subtitle, or adding a logo. In this section, we will present each of these.
48
48
49
49
### Table of Contents
50
50
@@ -54,10 +54,6 @@ A table of contents can be added by using the `table_of_contents` parameter. Pro
preamble = "You can enter arbitrary \\textbf{\\emph{tex}} in the preamble, but it must be double escaped. "
83
79
)
84
80
```
85
81
@@ -96,9 +92,9 @@ writeCodeBookLatex(ds, logo = "yougov")
96
92
97
93

98
94
99
-
### Suppress Zeroes
95
+
### Suppressing Zeroes
100
96
101
-
Although not recommended, there are some questions that have a significant amount of zero-filled categories (country of residence for example). This can lead to the end-user of the codebook scrolling through information that is useless to them.
97
+
Although not recommended, there are some questions that have a significant amount of zero-filled categories (country of residence for example). This can lead to the end-user of the codebook scrolling through pages and pages of zero filled categories. You can supress zeroes using the following:
You can also create a codebook from a generic dataset but you are required to create the meta data yourself. Below, we will discuss the format of the meta data and what you need to do to put it together.
116
+
117
+
Your meta data should include the following:
118
+
119
+
- alias: The short code for the name of the column
120
+
- descrption: A long description of the contents of the variables. If this is survey data, your question text would go here.
121
+
- name: This is a short name for the variable that is designed to provide flavor for the alias but no detail as in the description.
122
+
- notes: This is descriptive text that identifies a subset.
123
+
- recode: Required column but optional fill. Used in other processes where raw data requires additional manipulation or recoding.
124
+
125
+
> Important: We parse the meta data file to create the codebook, we don't parse the data other than for summarization, columns/variables not specified in the meta data are ignored.
126
+
127
+
```{r, eval = FALSE}
128
+
library(crunchtabs)
129
+
ds <- datasets::iris
130
+
meta <- data.frame(
131
+
alias = c(
132
+
"Sepal.Length",
133
+
"Sepal.Width",
134
+
"Petal.Length",
135
+
"Petal.Width",
136
+
"Species"
137
+
),
138
+
name = c(
139
+
"Sepal Length",
140
+
"Sepal Width",
141
+
"Petal Length",
142
+
"Petal Width",
143
+
"Iris Species"
144
+
),
145
+
description = c(
146
+
"The length of the flower's sepal",
147
+
"The width of the flower's sepal",
148
+
"The length of the flower's petals",
149
+
"The width of the flower's petals",
150
+
"The iris species"
151
+
),
152
+
notes = rep("", 5),
153
+
recode = rep(NA, 5),
154
+
stringsAsFactors = FALSE
155
+
)
156
+
157
+
writeCodeBookLatexGeneric(
158
+
ds[c(1,5)],
159
+
meta = meta[c(1,5),],
160
+
title = "Edgar Anderson's Iris Data",
161
+
subtitle = "The data were collected by Anderson, Edgar",
162
+
field_period = "1935",
163
+
sample_desc = "The irises of the Gaspe Peninsula",
164
+
preamble = "This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica.",
165
+
table_of_contents = TRUE,
166
+
)
167
+
```
168
+
169
+

170
+
171
+

172
+
173
+
## Known Limitations
174
+
175
+
- This software only supports latin characters. English, French, Spanish, and Portuguese will work out of the box. Other languages with significant special character or RTL are not supported.
\fancyhead[L]{{\fontsize{16}{24}\textbf{Edgar Anderson's Iris Data}}\fontsize{12}{18}\textbf{\\ The data were collected by Anderson, Edgar}}
70
+
71
+
72
+
\begin{document}
73
+
\setlength{\tabcolsep}{1em}
74
+
\setlength{\LTleft}{0pt}
75
+
\setlength{\LTright}{\fill}
76
+
\setlength{\LTcapwidth}{\textwidth}
77
+
\vspace{.25in}
78
+
79
+
\begin{longtable}[l]{ll}
80
+
Sample & The irises of the Gaspe Peninsula \\
81
+
Conducted & 1935 \\
82
+
\end{longtable}
83
+
This famous (Fisher's or Anderson's) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 50 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica.
0 commit comments