bergant / datamodelr

Data model diagrams in R
Other
285 stars 28 forks source link

Incompatibility with basic R eval(parse) command #24

Open unaivicente opened 1 year ago

unaivicente commented 1 year ago

Hello, First of all, great library.

There is a basic incompatibility with the basic R parse command. I have a script with a loop that gets automatic intersections out of big datasets.

Imagine I have this model: datamodel <- dm_from_data_frames(survey, quest_result, surv_result, question, section) And I am trying to add references. For that, I get a vector like this:

> ref [1] "quest_result$QuestionID == question$QuestionID, quest_result$SurveyID == question$SurveyID, quest_result$SurveyID == section$SurveyID, quest_result$SurveyResultID == surv_result$SurveyResultID, quest_result$SurveyID == surv_result$SurveyID"

When I use this as an eval(parse) argument...

datamodel <- dm_add_references( datamodel, eval(parse(text = ref)) ) It gives me an error: Error: Define references with logical expressions: dataframe1$column1 == dataframe2$column2, ...

Any ideas why?

Thank you!