Commit a0ff6216 authored by Leon-Charles Tranchevent's avatar Leon-Charles Tranchevent
Browse files

Added option to get the pheno data as factors or not.

parent 434ffc66
......@@ -6,7 +6,7 @@ Author: Leon-Charles Tranchevent
Maintainer: Leon-Charles Tranchevent <leon-charles.tranchevent@uni.lu>
Description: This package contains functions to analyse microarray data.
It is more a set of useful functions than a real package.
License: The Unlicense (see LICENSE)
License: file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
......
......@@ -8,11 +8,13 @@
#'
#' @param data_dir A string representing the folder that contains the clinical data.
#' @param clinical_file_name A string containing the file name. By default, this is 'ClinicalData.tsv'
#' @param use_factors A boolean stating whether the columns should be read as factors (default FALSE).
#' @param verbose A boolean representing whether the function should display log information. This
#' is TRUE by default.
#' @return An annotated data-frame that contains the clinical data.
load_clinical_data <- function(data_dir,
clinical_file_name = "ClinicalData.tsv",
use_factors = TRUE,
verbose = TRUE) {
# We define the I/Os.
......@@ -22,9 +24,16 @@ load_clinical_data <- function(data_dir,
}
# We load the clinical data.
pheno_data <- Biobase::AnnotatedDataFrame(utils::read.delim(file = clinical_data_file,
row.names = 1,
colClasses = "factor"))
pheno_data <- NULL
if (use_factors) {
pheno_data <- Biobase::AnnotatedDataFrame(utils::read.delim(file = clinical_data_file,
row.names = 1,
colClasses = "factor"))
} else {
# We do not use factors.
pheno_data <- Biobase::AnnotatedDataFrame(utils::read.delim(file = clinical_data_file,
row.names = 1))
}
# We clean up and log information.
rm(clinical_data_file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment