Nothing
#' Factor to Segments
#'
#' @param fac A factor where each level represents a segment
#'
#' @return A list of vectors, each vector contains the indices of the elements
#' of the corresponding segment
#' @export
#'
#' @examples
#' fac <- factor(c("a", "b", "a", "b", "c", "c"))
#' fac2seg(fac)
fac2seg <- function(fac){
if(!is.factor(fac))
stop("Input must be a factor")
lapply(1:length(levels(fac)),
function(i) which(fac==levels(fac)[i]))
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.