I’m working on a project involving epidemiological contact data, where I aim to visualise a network of cases and their contacts. The primary challenge I’m facing is how to use contact-specific attributes to colour nodes in the network, especially when the network visualization tool seem more oriented towards using case attributes.
Data Structure:
My dataset comprises two main parts:
- A
cases
dataframe that lists each case with a unique identifier and basic information (e.g.,case_id
,dob
,sex
). - A
contacts
dataframe that tracks the interactions between cases and their contacts, including contact-specific attributes likeDX
(diagnosis),sex
,dob
, andcontact_type
. The structure is something like this:
case_id
: Identifier for the casecontact_id
: Unique ID for the contact- Additional columns:
sex
,dob
,contact_type
,igra
,DX
Objective:
My main goal is to create a directed network where nodes represent both cases and contacts, and edges depict the interactions from cases to their contacts. Most importantly, I want to colour the nodes based on contact attributes, particularly DX
, which represents the screening diagnosis outcome.
Attempts and Issues:
- Using
epicontacts
: Initially, I attempted to use theepicontacts
package, which is designed for such epidemiological data. However, I ran into limitations regarding visualizing nodes colored by contact attributes, asepicontacts
(and its visualization functionvis_epicontacts
) primarily focuses on case attributes.
Specific Questions:
- For
epicontacts
Users: Has anyone successfully used contact attributes (likeDX
) to color nodes in a network visualization? If so, how did you integrate contact data into the visualization?
General Advice: Are there alternative R packages or methods that might be better suited for this type of network visualization where contact attributes are central to the analysis?