#' Convert a df column to token object by group(s).
#'
#' @name df2token
#' @param df a dataframe
#' @param token Colname to be tokenized, as string
#' @param by Colname(s) to group token object, as string
#' @return A list (or tokens object)
#'
#' @export
#' @rdname df2token
#'
#'
df2token <- function(df,
token,
by = c('doc_id')){
nn <- lapply(1:length(by), function(x) df[[by[x]]])
df$id99 <- do.call("paste", c(nn, sep=":"))
split(df[[token]], df$id99)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.