Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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 2b040cd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/parser.R
Expand Up @@ -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]
Expand Down

0 comments on commit 2b040cd

Please sign in to comment.