r-causal / causal-inference-in-R

Causal Inference in R: A book!
https://www.r-causal.org/
185 stars 49 forks source link

Warning about deprecated arguments / usage in book chapter #249

Closed strengejacke closed 1 month ago

strengejacke commented 1 month ago

Great book! When reading the DAG chapter, I realized there was a warning, which can likely be avoided when updating the code? See here:

https://www.r-causal.org/chapters/05-dags#dags-in-r

podcast_dag <- [dagify](https://r-causal.github.io/ggdag/reference/dagify.html)(
  podcast ~ mood + humor + prepared,
  exam ~ mood + prepared,
  coords = [time_ordered_coords](https://r-causal.github.io/ggdag/reference/time_ordered_coords.html)(
    [list](https://rdrr.io/r/base/list.html)(
      # time point 1
      [c](https://rdrr.io/r/base/c.html)("prepared", "humor", "mood"),
      # time point 2
      "podcast",
      # time point 3
      "exam"
    )
  ),
  exposure = "pod[c](https://rdrr.io/r/base/c.html)ast",
  outcome = "exam",
  labels = c(
    podcast = "podcast",
    exam = "exam score",
    mood = "mood",
    humor = "humor",
    prepared = "prepared"
  )
)
[ggdag](https://r-causal.github.io/ggdag/reference/ggdag.html)(podcast_dag, use_labels = "label", text = FALSE) +
  [theme_dag](https://r-causal.github.io/ggdag/reference/theme_dag_blank.html)()

Warning: The text argument of geom_dag() no longer accepts logicals as of ggdag 0.3.0. ℹ Set use_text = FALSE. To use a variable other than node names, set text = variable_name ℹ The deprecated feature was likely used in the ggdag package. Please report the issue at https://github.com/r-causal/ggdag/issues. Warning: The use_labels argument of geom_dag() must be a logical as of ggdag 0.3.0. ℹ Set use_labels = TRUE and label = label ℹ The deprecated feature was likely used in the ggdag package. Please report the issue at https://github.com/r-causal/ggdag/issues.

malcolmbarrett commented 1 month ago

Thanks for catching! Yes, this will naturally resolve with #244 but in the meantime I'll disable the warning

Incidentally, later in this chapter, I talk about what I mentioned on LinkedIn about being a bit more defensive in your adjustment strategy vs just the minimal adjustment set. So now you know my opinion 😛