Skip to content

Instantly share code, notes, and snippets.

@tilltnet
Created August 6, 2024 05:04
Show Gist options
  • Save tilltnet/2226c7003b1472d35fab236255814b98 to your computer and use it in GitHub Desktop.
Save tilltnet/2226c7003b1472d35fab236255814b98 to your computer and use it in GitHub Desktop.
Filter alter-alter ties before density calculatio
---
title: "Filter alter-alter ties"
format: html
---
Create a minimal `egor` object as an example.
```{r}
library(egor)
alters <- tibble(
egoID = rep(1:5, 3),
alterID = rep(1:3, 5)
)
egos <- tibble(egoID = 1:5)
aaties <- tibble(
egoID = sample(1:5, 30, replace = TRUE),
Source = sample(1:3, 30, replace = TRUE),
Target = sample(1:3, 30, replace = TRUE),
weight_chr = sample(c("yes", "no"), 30, replace = TRUE)
)
e <- egor(alters, egos, aaties)
```
```{r}
e <-
e |>
activate(aatie) |>
filter(weight_char == "yes") |>
activate(ego)
ego_density(e)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment