Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PPS
PPS Data Management
Commits
143a967a
Commit
143a967a
authored
Mar 02, 2021
by
bob
Browse files
Replace sapply() by type safe vapply()
Avoid unexpected coercicion by sapply().
parent
5eedcbfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/1_extract_metadata.R
View file @
143a967a
...
...
@@ -168,8 +168,8 @@ process_sheet <- function(file, sheet) {
## From the first row of the file, extract...
header
<-
strsplit
(
as.character
(
dat
[
1
,
]),
"\\$"
)
variables
<-
s
apply
(
header
,
`[`
,
1
)
# variable names
units
<-
s
apply
(
header
,
`[`
,
2
)
# units
variables
<-
v
apply
(
header
,
`[`
,
1
,
FUN.VALUE
=
character
(
1
)
)
# variable names
units
<-
v
apply
(
header
,
`[`
,
2
,
FUN.VALUE
=
character
(
1
)
)
# units
## Assign variable names as column names
names
(
dat
)
<-
variables
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment