Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider 3929e178 rédigé par simon.chevolleau's avatar simon.chevolleau
Parcourir les fichiers

feature: assert dat type and filename is not null

parent 86c68988
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -35,12 +35,14 @@ writeTable <- function(dat, fileName = NULL, sepUser = '\t', rownames=TRUE, nThr ...@@ -35,12 +35,14 @@ writeTable <- function(dat, fileName = NULL, sepUser = '\t', rownames=TRUE, nThr
#' @description WRAPPER : Write a dataframe using threading with data.table package #' @description WRAPPER : Write a dataframe using threading with data.table package
#' to a separated text file #' to a separated text file
# LIBRARIES
require(data.table) require(data.table)
# TESTS
assert("You must submit a dataframe or a matrix", is.data.frame(dat) || is.matrix(dat))
assert("You must submit a file name", !is.null(fileName))
setDTthreads(threads=1) setDTthreads(threads=1)
if(is.null(fileName)){
fileName <- paste0('default.', ifelse(sepUser == '\t', 'tsv', 'csv'))
print(paste0(fileName, ' has been written to : ', getwd()))
}
if (rownames){ if (rownames){
datRowNames <- data.frame(rownames(dat)) datRowNames <- data.frame(rownames(dat))
dat <- cbind(datRowNames, dat) dat <- cbind(datRowNames, dat)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter