# simple data.frame example
txt_df <- gv(ChickWeight, "chick")
cat(txt_df)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
DiagrammeR::grViz(txt_df)
}
# simple database example
db <- autodb(ChickWeight)
txt_db <- gv(db)
cat(txt_db)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
DiagrammeR::grViz(txt_db)
}
# simple relation schemas
rschema <- synthesise(discover(ChickWeight))
txt_rschema <- gv(rschema)
cat(txt_rschema)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
DiagrammeR::grViz(txt_rschema)
}
# simple database schema
dschema <- normalise(discover(ChickWeight))
txt_dschema <- gv(dschema)
cat(txt_dschema)
DiagrammeR::grViz(txt_dschema)
# simple relations
rel <- create(synthesise(discover(ChickWeight)))
txt_rel <- gv(rel)
cat(txt_rel)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
DiagrammeR::grViz(txt_rel)
}
# container types and missing values
nested <- data.frame(key = 1:4, nullable = c(1:3, NA))
## matrices are reported with their column count and contained type
## matrix rows only count as missing if the entire row is missing
nested$matrix <- matrix(c(1:2, NA, NA, 5:7, NA, 9:11, NA), ncol = 3)
## lists and data frames aren't checked for missing values, because it's
## unclear what should count
nested$list <- list(1L, 2:3, NULL, NA)
nested$df <- data.frame(a = c(1:3, NA), b = c(1:2, NA, NA))
## lists are reported with any common element length/type
nested$uniform_list <- list(1:2, 3:4, 5:6, 7:8)
## container type information can be nested
nested$matrix_list <- list(
matrix(1:4, ncol = 2),
matrix(5:8, ncol = 2),
matrix(9:12, ncol = 2),
matrix(13:16, ncol = 2)
)
nested$nested_list <- replicate(4, list(1:2, 3:4, 5:6), simplify = FALSE)
txt_nested <- gv(nested)
cat(txt_nested)
if (requireNamespace("DiagrammeR", quietly = TRUE)) {
DiagrammeR::grViz(txt_nested)
}
Run the code above in your browser using DataLab