#' Turn a tall data frame from makeTallDataFrame into a wide data frame
#'
#' This function creates a \code{data.frame} containing data for different data types in a form suitable for further statistical modelling in R.
#'
#' @param df A \code{data.frame} in tall format generated by \code{makeTallDataFrame}
#' @return A \code{data.frame} in wide format
#' @export
makeWideFromTallDataFrame <- function(df) {
#create matrix
output.df <- df %>% dplyr::transmute(unified_id, fn=paste(assayed_id,data_type,sep='_'), value) %>%
tidyr::spread(fn, value)
#reorder columns
output.df <- output.df %>% dplyr::select(unified_id, ends_with('_resp'), everything())
#make mutation fields into factors
output.df <- output.df %>% dplyr::mutate_each(dplyr::funs(as.factor), ends_with('_hybcap|_cosmicclp'))
return(output.df)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.