R/tidy_format.R

tidy_gct <- function(gct, value_col = "value") {
    df <- tibble::as_data_frame(gct$mat)
    df <- tibble::rownames_to_column(df, "rid")
    df <- tidyr::gather_(df, "cid", value_col, colnames(df)[2:ncol(df)])
    df <- dplyr::left_join(df, gct$meta$cols, "cid")
    df <- dplyr::left_join(df, gct$meta$rows, "rid")
    df <- dplyr::select_(df, c(colnames(gct$meta$rows), colnames(gct$meta$cols), value_col))
    return(df)
}
biolabntua/moach documentation built on May 12, 2019, 9:24 p.m.