I have a tricky question I’m not sure how to handle on my own. Let’s say I have a dataset of students with their ID and school.

```
library(DeclareDesign)
draw_date <- function(n, lower, upper){
sample(seq(as.Date(lower), as.Date(upper), by="day"), n)
}
all_students <- declare_population(N = 100,
birthday = draw_date(N, "1990/01/01", "1994/01/01"),
grade_level = as.numeric(as.factor(year(birthday))),
school = draw_categorical(N = N,
category_labels = LETTERS[1:4],
prob = c(.25, .25, .25, .25)))()
```

How could I use this to make a dataset to simulate “attendance” for a year? Here the attendance dataset has the attendance everyday for each student (so N * date rows) and has the variables `student_ID`

, `school`

, `date`

, and `attendance`

.

Ideally I’d like to make the probability of attendance conditional on the school, and then try make some of the data “missing”, again conditional on school

Thank you for your help!