#' Exclude double interactions
#'
#' Function to exclude double focal and action_partner interactions used for ap, bc, and gr, from duration calculator i.e. when they were focalled on the same day, and interact, keep only one
#'
#' @param df A data frame of interactions. Typically generated by the "duration decider" function. Needs columns "focal_dyad_count" and "partner_dyad_count". (created by get_p_dyad_count).
#'
#' @return A dataframe with double interactions filtered out.
#'
#' @export
#' @import dplyr
excl_dbl_int <- function(df, join_by){
df <- check_part(df)
df_int <- get_int_decision(df)
# get column names in common to join by
join_by <- intersect(names(df), names(df_int))
# merge df with df_int, keep all rows
df <-
df %>%
left_join(df_int, by = join_by) %>%
mutate(double_interaction = ifelse(is.na(.$double_interaction),
"no", .$double_interaction)) %>%
filter(!double_interaction == "exclude")
# delete temp rowid col
df$rowid <- NULL
return(df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.