langcog / childesr

R interface to childes-db
14 stars 6 forks source link

get_participants age filtering #44

Closed JMankewitz closed 4 years ago

JMankewitz commented 4 years ago

As is, filtering by an interval returns children who are entirely outside that interval (eg get_participants(age = c(4,20)) returns participant 2 with an age range of min_age = 146.72581 and max_age = 146.75866)

If we want any child who's interval overlaps with the input interval, this logic covers all the bases: (min_age <= days_1 & max_age >= days_2)| (min_age >= days_1 & max_age <= days_2)| (min_age <= days_1 & max_age >= days_1)| (min_age <= days_2 & max_age >= days_2)

If we want only children who's age interval is strictly within the input interval, (min_age >= days_1 & max_age <= days_2) works, too. https://github.com/langcog/childesr/blob/f3de7028bb41af1290dfd9344b440040c9271022/R/childesr.R#L280