Giter Club home page Giter Club logo

redamor's People

Stargazers

Dan Hively avatar  avatar Andrew Allen Bruce avatar Franz Prante avatar  avatar Martins avatar Andrew Skelton avatar Fernando Souza avatar Jeff Munzar avatar cloudcollege.org avatar Jarren Santos avatar Athos Petri Damiani avatar Tanner Stauss avatar Srikanth K S avatar Philipp avatar Eduardo dos Santos Almeida avatar Xiangyun Huang avatar Jinhwan Kim avatar

Watchers

Patrice Godard avatar cloudcollege.org avatar

redamor's Issues

Error with `modelToVn` when running `model_relational_data` with a RelDataModel as input

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!

give RelTableModel named arguments

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 ?

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.