YEAR: 2017 128 | COPYRIGHT HOLDER: Emil Hvitfeldt 129 |130 | 131 |
NEWS.md
126 | Repeating of indexes
134 | 135 |break_help(x)138 | 139 |
x | 144 |Numerical, vector. |
145 |
---|
Numerical.
151 | 152 | 153 |157 |#> [1] 1 2 2 3 3 3#> [1] 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 155 | #> [39] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 156 | #> [77] 4 4 4 4 4 4 4 4 4 4 4
R/ggpage_quick.R
128 | ggpage_quick.Rd
Creates a quick visualization of the page layout
134 | 135 |ggpage_quick(book, lpp = 25, character_height = 3, 138 | vertical_space = 1, x_space_pages = 10, y_space_pages = 10, 139 | nrow = NULL, ncol = NULL, bycol = TRUE)140 | 141 |
book | 146 |Character or data.frame. Can either have each element be a 147 | separate line or having each element being separate words. |
148 |
---|---|
lpp | 151 |Numeric. Lines Per Page. Number of lines allocated for each page. |
152 |
character_height | 155 |Numeric. Relative size of the height of each letter 156 | compared to its width. |
157 |
vertical_space | 160 |Numeric. Distance between each lines vertically. |
161 |
x_space_pages | 164 |Numeric. Distance between pages along the x-axis. |
165 |
y_space_pages | 168 |Numeric. Distance between pages along the y-axis. |
169 |
nrow | 172 |Numeric. Number of rows of pages, if omitted defaults to square 173 | layout. |
174 |
ncol | 177 |Numeric. Number of columns of pages, if omitted defaults to 178 | square layout. |
179 |
bycol | 182 |Logical. If TRUE (the default) the matrix is filled by 183 | columns, otherwise the matrix is filled by rows. |
184 |
A ggplot object with the given visualization.
190 | 191 | 192 |213 |library(dplyr) 194 | library(stringr) 195 | library(ggplot2) 196 | library(tidytext) 197 | library(ggpage) 198 | # quick 199 | ## data.frame with full lines 200 | ggpage_quick(tinderbox)#> Error in check_input(x): Input must be a character vector of any length or a list of character 203 | #> vectors, each of which has a length of 1.#> Error in check_input(x): Input must be a character vector of any length or a list of character 206 | #> vectors, each of which has a length of 1.## vector with single words 207 | ggpage_quick(tinderbox %>% 208 | unnest_tokens(text, text) %>% 209 | pull(text))#> Error in check_input(x): Input must be a character vector of any length or a list of character 210 | #> vectors, each of which has a length of 1.211 | # nrow and ncol 212 | ggpage_quick(tinderbox, nrow = 2)ggpage_quick(tinderbox, ncol = 2)
Adjust lines
134 | 135 |line_align(line, max_length, type)138 | 139 |
line | 144 |data.frame |
145 |
---|---|
max_length | 148 |numerical. number of letters allowed on a line. |
149 |
type | 152 |Type of line alignment. Must be one of "left", "right" or "both". |
153 |
data.frame
159 | 160 | 161 |R/nest_paragraphs.R
129 | nest_paragraphs.Rd
extents the str_wrap() function from the stringr package to work with longer 135 | strings.
136 | 137 |nest_paragraphs(data, input, ...)140 | 141 |
data | 146 |data.frame. With one paragraph per row. |
147 |
---|---|
input | 150 |column that gets split as string or symbol. |
151 |
... | 154 |Extra arguments passed to str_wrap. |
155 |
data.frame.
161 | 162 | 163 |R/utils.R
128 | paper_shape.Rd
Identify the edges of the paper of each page
134 | 135 |paper_shape(data)138 | 139 |
data | 144 |data.frame created by ggpage_build. |
145 |
---|
data.frame,
151 | 152 | 153 |166 |#> # A tibble: 9 x 5 155 | #> page xmin xmax ymin ymax 156 | #> <int> <dbl> <dbl> <dbl> <dbl> 157 | #> 1 1 168 90 -114 -213 158 | #> 2 2 167 90 -224 -323 159 | #> 3 3 168 90 -334 -433 160 | #> 4 4 259 180 -114 -213 161 | #> 5 5 258 180 -224 -323 162 | #> 6 6 259 180 -334 -433 163 | #> 7 7 349 270 -114 -213 164 | #> 8 8 349 270 -224 -323 165 | #> 9 9 348 270 -334 -377
Converts a word vector into a line vector with variable paragraph lengths.
134 | 135 |para_index(n, FUN, ...)138 | 139 |
n | 144 |Numeric. Numbers of words. |
145 |
---|---|
FUN | 148 |Numeric. how many words to split whole string by. |
149 |
... | 152 |Extra arguments. |
153 |
Numeric. paragraph indicator.
159 | 160 |FUN most be a function that takes in a number n and returns a vector of 163 | natural numbers.
164 | 165 | 166 |See magrittr::%>%
for details.
lhs %>% rhs138 | 139 | 140 |
A tidy data.frame containing the entire story of The tinder-box by H.C.
137 | Andersen with two columns: text
which contains the text of the
138 | fairy tale divided into elements of up to about 80 characters each and
139 | book
giving the name of the fairy tale in question.
tinderbox
144 |
145 | A data frame with 211 rows and 2 variables:
character string up to 80 characters each
name of the fairy tale
A tidy data.frame containing the entire story of The tinder-box by H.C.
136 | Andersen with two columns: text
which contains the text of the
137 | fairy tale divided into paragraphs.
tinderbox_paragraph
142 |
143 | A data frame with 11 rows and 1 variables:
character string up to 80 characters each
R/utils.R
129 | word_to_line.Rd
extents the str_wrap() function from the stringr package to work with longer 135 | strings.
136 | 137 |word_to_line(words, wot_number = 1000)140 | 141 |
words | 146 |data.frame. Where each row is a separate word words with the 147 | column name text. |
148 |
---|---|
wot_number | 151 |Numeric. how many words to split whole string by. |
152 |
Character. have each element be a separate line.
158 | 159 | 160 |