patzaw / redamor Goto Github PK
View Code? Open in Web Editor NEWRelational Data Modeler in R
Home Page: https://patzaw.github.io/ReDaMoR/
License: GNU General Public License v3.0
Relational Data Modeler in R
Home Page: https://patzaw.github.io/ReDaMoR/
License: GNU General Public License v3.0
When trying to launch the GUI with an existing model built programmatically in a script or RMarkdown document, model_relational_data
will fail to launch when a RelDataModel
object is passed as input. Example:
library(ReDaMoR)
fields_1 <- data.frame(
name=c("val1","val2","val3"),
type=c("character","integer","logical"),
nullable=c(FALSE,FALSE,TRUE),
unique=c(TRUE,FALSE,FALSE),
comment=as.character(c(NA,NA,NA))
)
fields_2 <- data.frame(
name=c("val1","val4","val5"),
type=c("character","integer","logical"),
nullable=c(FALSE,FALSE,TRUE),
unique=c(TRUE,FALSE,FALSE),
comment=as.character(c(NA,NA,NA))
)
table_list <- list()
table_list[[1]] <- RelTableModel(tableName="Table1", fields=fields_1)
table_list[[2]] <- RelTableModel(tableName="Table2", fields=fields_2)
my_model <- RelDataModel(table_list)
model_relational_data(my_model)
This returns:
Error in `dplyr::mutate()`:
ℹ In argument: `color.background = ifelse(is.na(.data$color.background), "lightgrey", .data$color.background)`.
Caused by error in `.data$color.background`:
! Column `color.background` not found in `.data`.
The problems seems to be in the call to modelToVn
from auto_layout
, which expects the optional display
input for a RelTableModel
to be present when executing:
if (!is.null(nodes) && nrow(nodes) > 0) {
nodes <- nodes %>% dplyr::mutate(
color.border = !!border,
color.highlight.border = !!highlightBorder,
color.background = ifelse(
is.na(.data$color.background), # This is what fails, because there is no variable '.data$color.background'
!!color,
.data$color.background)) %>%
dplyr::mutate(color.highlight.background = .data$color.background)
nodes$id <- names(model)
}
I think the reason for this failure is that RelTableModel
sets the display
variables x
,y
,color
to NULL
on default, rather than NA
. Setting Null
in a list context drops the item entirely, rather than specifying an empty value. If I replace my example RelTableModel
definitions above with the following:
table_list[[1]] <- RelTableModel(tableName="Table1", fields=fields_1, display=list(x=as.numeric(NA),y=as.numeric(NA),color=as.character(NA),comment=as.character(NA)))
table_list[[2]] <- RelTableModel(tableName="Table2", fields=fields_1, display=list(x=as.numeric(NA),y=as.numeric(NA),color=as.character(NA),comment=as.character(NA)))
Things seem to work as intended.
Cheers!
Hi,
First of all this package is awesome! Much better than all alternatives I've tried. Hats off to you.
One potential improvement could be to change RelTableModel() to take in named arguments, as opposed to one named list. I understand it's easier to just take in a named list when used in the shiny app you have. However, I use this package without the shiny app, where i directly call RelTableModel() in R code. In this use case, it makes much more sense for the function to take named arguments eg tableName, fields, primaryKey etc. For the shiny use case, can always do.call
thoughts?
Is it possible to import all/selected dataframes from R environment in order to start modeling?
I see that it can actually import from SQL or JSON, but I wonder if it's possible to gather the structure of dataframes from R environment and start modeling the workbench from this point on.
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.