# NOT RUN {
## data frame
example_vector <- as.data.frame(c("ao1", "a02", "a03"))
# }
# NOT RUN {
## run with default options
## pdf file will be "example.pdf" saved into a temp directory
temp_file <- tempfile()
create_PDF(Labels = example_vector, name = temp_file)
## view example output from temp folder
system2("open", paste0(temp_file, ".pdf"))
# }
# NOT RUN {
## run interactively. Overrides default pdf options
if(interactive()){
create_PDF(user = TRUE, Labels = example_vector)
}
# }
# NOT RUN {
## run using a data frame, automatically choosing the "label" column
example_df <- data.frame("level1" = c("a1", "a2"), "label" = c("a1-b1",
"a1-b2"), "level2" = c("b1", "b1"))
create_PDF(user = FALSE, Labels = example_df, name = file.path(tempdir(), "example_2"))
# }
# NOT RUN {
# }
# NOT RUN {
## run using an unnamed data frame
example_df <- data.frame(c("a1", "a2"), c("a1-b1", "a1-b2"), c("b1", "b1"))
## specify column from data frame
create_PDF(user = FALSE, Labels = example_df[,2], name = file.path(tempdir(), "example_3"))
# }
# NOT RUN {
## create linear (code128) label rather than matrix (2D/QR) labels
example_df <- data.frame(c("a1", "a2"), c("a1-b1", "a1-b2"), c("b1", "b1"))
## specify column from data frame
create_PDF(user = FALSE, Labels = example_df, name = file.path(tempdir(),
"example_4", type = "linear"))
# }
Run the code above in your browser using DataLab