Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
parser: devtools::check threw an error so empty columns will now be r…
…emoved in a different more memory efficient way.
  • Loading branch information
HendrikSchultheis committed Oct 16, 2019
1 parent a062563 commit 2b040cda8e45c1c6b1853885704d0b6e2191dcc5
Showing 1 changed file with 7 additions and 1 deletion.
@@ -365,7 +365,13 @@ parser <- function(file, dec = ".") {
names(metadata) <- as.character(metadata[1])

# remove empty columns
metadata <- metadata[, which(unlist(lapply(metadata, function(x) !all(is.na(x) || x == "")))), with = FALSE]
empty_cols <- union(
which(colSums(is.na(metadata)) == nrow(metadata)), # indices of full na columns
which(colSums(metadata == "") == nrow(metadata)) # indices of full "" columns
)
if (length(empty_cols) > 0) {
metadata[, (empty_cols) := NULL]
}

# delete first line
metadata <- metadata[-1]

0 comments on commit 2b040cd

Please sign in to comment.