Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error the condition has length > 1 #67

Open
llrs opened this issue Jan 20, 2023 · 1 comment
Open

Error the condition has length > 1 #67

llrs opened this issue Jan 20, 2023 · 1 comment

Comments

@llrs
Copy link

llrs commented Jan 20, 2023

I made a mistake and tried to check adjustment from a plot instead of the of the DAG and there was an unexpected error:

library("dagitty")
library("ggdag")
#> 
#> Attaching package: 'ggdag'
#> The following object is masked from 'package:stats':
#> 
#>     filter
dag <- dagitty("dag{ 
  a -> b b -> c c -> d
 }")
plot <- ggdag(dag) + 
  theme_dag() + theme_dag_gray()
ggdag_adjustment_set(plot, outcome = "a")
#> Error in if (class(x) == "dagitty") {: the condition has length > 1

I think this could be just a simple case of replacing class(x) by is(x, "dagitty") in

if( class(x) == "dagitty" ){

Created on 2023-01-20 with reprex v2.0.2

@malcolmbarrett
Copy link
Contributor

That code should use inherits(), either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants