Commit 143a967a authored by bob's avatar bob
Browse files

Replace sapply() by type safe vapply()

Avoid unexpected coercicion by sapply().
parent 5eedcbfb
......@@ -168,8 +168,8 @@ process_sheet <- function(file, sheet) {
## From the first row of the file, extract...
header <- strsplit(as.character(dat[1, ]), "\\$")
variables <- sapply(header, `[`, 1) # variable names
units <- sapply(header, `[`, 2) # units
variables <- vapply(header, `[`, 1, FUN.VALUE = character(1)) # variable names
units <- vapply(header, `[`, 2, FUN.VALUE = character(1)) # units
## Assign variable names as column names
names(dat) <- variables
......
Supports Markdown
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