View source: R/plantuml_file.R
plantuml_file | R Documentation |
The function either plots the object including values (yaml
and json
) or
loads the object and plots the structure (csv
and rds
).
Exactly one of the two arguments (file
or text
) needs tobe specified.
Exactly one of the two arguments (file
or text
) needs tobe specified.
This is a convenience function which only reads the csv
file using
read.csv(file, ...)
and converts the resulting data.frame
to a plantuml
object using plantuml()
.
This is a convenience function which only reads the rds
file using
readRDS(file, ...)
and converts the resulting object to a plantuml
object using plantuml()
.
plantuml_file(file, preamble = "", ...)
plantuml_yaml(file, text, preamble = "", ...)
plantuml_json(file, text, preamble = "", ...)
plantuml_csv(file, ...)
plantuml_rds(file, ...)
file |
file name of the |
preamble |
text to be inserted after the |
... |
additional arguments. Will be passed to |
text |
yaml text to be converted. The function does not do any checking if the file is valid yaml! |
a plantuml
containing the yaml file for plotting
a plantuml
containing the json file for plotting
a plantuml
containing the structure of the csv
file for plotting
a plantuml
containing the structure of the rds
file for plotting
## Not run:
plantuml_file("name.yml")
plantuml_file("name.yaml")
plantuml_file("name.json")
plantuml_file("name.rds")
plantuml_file("name.csv")
## End(Not run)
## some preparations
x1 <- "name: Test yml\na:\n- a\n- d\n- c\nB:\n- C\n- D\n- E\nx:\n one: 0.2885\n two: 0.7498\n"
x2 <- "name: Test yml\na:\n- a\n- b\n- c\nB:\n- C\n- D\n- E\nx:\n one: 0.2865\n two: 0.7498\n"
fn1 <- tempfile(fileext = ".yml")
fn2 <- tempfile(fileext = ".yml")
writeLines(x1, fn1)
writeLines(x2, fn2)
## and now the example
plot(plantuml_yaml(fn1))
## Now let's see the differences between `fn1` and `fn2`
## this requires the package `yaml` to be installed
if (require(yaml)) {
plot(
plantuml_yaml(
file = fn1,
preamble = diff_yaml_json(yaml::read_yaml(fn1), yaml::read_yaml(fn2))
)
)
}
## and cleanup
unlink(fn1)
unlink(fn2)
## some preparations
x <- '{"name":["Test json"],"a":["a","b","c"],"B":["C","D","E"],"x":[0.6464,0.6879]}'
fn <- tempfile(fileext = ".json")
writeLines(x, fn)
## and now the example
plot(plantuml_json(fn))
## and cleanupo
unlink(fn)
## some preparations
x <- data.frame(
a = c("a", "b", "c"),
B = c("C", "D", "E"),
x = c(0.77, 0.38, 4.43),
bool = c(TRUE, FALSE, FALSE)
)
fn <- tempfile(fileext = ".csv")
write.csv(x, fn)
## and now the example
plot(plantuml_csv(fn))
# and only the fors columns (the rownames will not all be there)
plot(plantuml_csv(fn, nrows = 1))
# or character vectors as factors
plot(plantuml_csv(fn, as.is = FALSE))
## and cleanupo
unlink(fn)
## some preparations
x <- list(
name = "Test list",
a = c("a", "b", "c"),
B = c("C", "D", "E"),
x = c(0.776318477466702, 0.381654617609456)
)
fn <- tempfile(fileext = ".rds")
saveRDS(x, fn)
## and now the example
plot(plantuml_rds(fn))
## and cleanupo
unlink(fn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.