Skip to content

add reprex code on only linelist FALSE or TRUE as callout box #184

Closed
@avallecam

Description

@avallecam

@joshwlambert would you agree to add this reprex to make the situation more visible? I can add it as a spoiler callout block to make it expandable on demand.

# Three subjects on linelist
sample_linelist <- tibble::tibble(
  id = c("id1", "id2", "id3")
)

# Four infector-infectee pairs with Five subjects in contact data
sample_contact <- tibble::tibble(
  from = c("id1","id1","id2","id4"),
  to = c("id2","id3","id4","id5")
)

# make an epicontacts object
sample_net <- epicontacts::make_epicontacts(
  linelist = sample_linelist,
  contacts = sample_contact,
  directed = TRUE
)

# count secondary cases per subject from linelist only
epicontacts::get_degree(x = sample_net, type = "out", only_linelist = TRUE)
#> id1 id2 id3 
#>   2   1   0

# count secondary cases per subject from contact only
epicontacts::get_degree(x = sample_net, type = "out", only_linelist = FALSE)
#> id1 id2 id4 id3 id5 
#>   2   1   1   0   0

Created on 2025-04-08 with reprex v2.1.1

Originally posted by @avallecam in #169 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions