Skip to content

Commit

Permalink
removed closed connection message, updated cheatsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
florianerhard committed Mar 9, 2023
1 parent 1ce7695 commit 0190e70
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
read.tsv=function(t,verbose=FALSE,stringsAsFactors=FALSE,...) {

readit=function(file,...)
if (requireNamespace("data.table",quietly = TRUE) && summary(file(file))$class!="gzfile") {
if (requireNamespace("data.table",quietly = TRUE) && !grepl("\\.gz$",file)) {
as.data.frame(data.table::fread(file = file,stringsAsFactors=stringsAsFactors,check.names=FALSE,data.table = FALSE,...))
} else {
read.delim(file = file,stringsAsFactors=stringsAsFactors,check.names=FALSE,...)
Expand All @@ -21,7 +21,6 @@ read.tsv=function(t,verbose=FALSE,stringsAsFactors=FALSE,...) {
if (verbose) cat("Reading file...\n")
t=readit(t,...)
}

if (stringsAsFactors==TRUE) t=as.data.frame(lapply(t,function(c) if (is.character(c)) factor(c,levels=unique(c)) else c),check.names=FALSE)
t
}
Expand Down
Binary file modified cheatsheet/cheatsheet.grandR.pdf
Binary file not shown.

0 comments on commit 0190e70

Please sign in to comment.