R/switching_equation.R

Defines functions switching_equation

switching_equation <- function(pos_mat, assignment_vec) {

  Y <- pos_mat[cbind(
         1:nrow(pos_mat),
         match(assignment_vec, colnames(pos_mat))
  )]

  return(Y)
}

Try the ri2 package in your browser

Any scripts or data that you put into this service are public.

ri2 documentation built on May 28, 2022, 1:06 a.m.