@@ -18,15 +18,15 @@ knitr::opts_chunk$set(
1818
1919``` {r, eval=FALSE}
2020# dev version from GitHub
21- install.packages("pak",
22- repos =
23- sprintf(
24- "https://r-lib.github.io/p/pak/stable/%s/%s/%s",
25- .Platform$pkgType,
26- R.Version()$os,
27- R.Version()$arch
28- )
29- )
21+ install.packages("pak",
22+ repos =
23+ sprintf(
24+ "https://r-lib.github.io/p/pak/stable/%s/%s/%s",
25+ .Platform$pkgType,
26+ R.Version()$os,
27+ R.Version()$arch
28+ )
29+ )
3030pak::pak("frederikfabriciusbjerre/caugi")
3131
3232# ... or wait for the first CRAN release
@@ -70,9 +70,9 @@ cg <- caugi_graph(
7070 A %-->% B + C,
7171 B %-->% D,
7272 C %-->% D,
73- class = "DAG", # optional, guarantees acyclicity by construction
74- simple = TRUE, # default
75- build = TRUE # build now; otherwise built lazily on first query
73+ class = "DAG", # optional, guarantees acyclicity by construction
74+ simple = TRUE, # default
75+ build = TRUE # build now; otherwise built lazily on first query
7676)
7777```
7878
@@ -117,16 +117,16 @@ Use `+` to fan out from one side, and `c(...)` or parentheses to group.
117117
118118``` {r}
119119caugi_graph(
120- X %-->% Y + Z, # X → Y and X → Z
121- c(Y, Z) %-->% W, # Y → W and Z → W
122- (A + B) %---% (C + D) # all undirected pairs across groups
120+ X %-->% Y + Z, # X → Y and X → Z
121+ c(Y, Z) %-->% W, # Y → W and Z → W
122+ (A + B) %---% (C + D) # all undirected pairs across groups
123123)
124124```
125125
126126Unconnected symbols also declare nodes:
127127
128128``` {r}
129- caugi_graph(A, B, C) # declares three isolated nodes
129+ caugi_graph(A, B, C) # declares three isolated nodes
130130```
131131
132132
@@ -155,7 +155,7 @@ You can check graph properties with the following functions.
155155
156156``` {r}
157157is_acyclic(cg)
158- is_dag(cg)
158+ is_dag(cg)
159159is_pdag(cg)
160160```
161161
@@ -174,11 +174,11 @@ cg <- add_edges(cg, E %-->% F)
174174or you can use standard evaluation:
175175
176176``` {r}
177- cg <- add_edges(cg,
178- from = c("D", "G"),
179- edge = c("-->", "o->"),
180- to = c("E", "H")
181- )
177+ cg <- add_edges(cg,
178+ from = c("D", "G"),
179+ edge = c("-->", "o->"),
180+ to = c("E", "H")
181+ )
182182```
183183
184184Besides ` add_edges ` , you can also use ` remove_edges() ` , ` set_edges() ` , ` add_nodes() ` , ` remove_nodes() ` , ` set_nodes() ` , and ` subgraph() ` .
0 commit comments