Skip to content

Instantly share code, notes, and snippets.

@cbaragao
Last active October 8, 2025 21:35
Show Gist options
  • Select an option

  • Save cbaragao/11039b8cf598d5a84e1e37eeaae4eee1 to your computer and use it in GitHub Desktop.

Select an option

Save cbaragao/11039b8cf598d5a84e1e37eeaae4eee1 to your computer and use it in GitHub Desktop.
(df as table, independent as text, dependent as text, family as text)=>
let
Source =
R.Execute(
"df <- dataset" &
"#(lf)logit <- glm(" & dependent & " ~ " & independent & ", data = df, family = """ & family &""") " &
"#(lf)summary_model <- summary(logit) " &
"#(lf)coef_df <- as.data.frame(summary_model$coefficients) " &
"#(lf)coef_df$Variable <- rownames(coef_df) " &
"#(lf)coef_df <- coef_df[, c(""Variable"", ""Estimate"", ""Std. Error"", ""z value"", ""Pr(>|z|)"")] " &
"#(lf)colnames(coef_df) <- c(""Variable"", ""Estimate"", ""Std_Error"", ""Z_value"", ""P_value"")" &
"#(lf)coef_df$Significant <- coef_df$P_value <= 0.05",[dataset = df])
in
Source{[Name="coef_df"]}[Value]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment