Skip to content

Commit

Permalink
Merge pull request #175 from cfbeuchel/colheader_harmonisation_improv…
Browse files Browse the repository at this point in the history
…ements

Add checks to standardise_sumstats_column_headers_crossplatform()
  • Loading branch information
Al-Murphy authored Feb 9, 2024
2 parents ae1fcd3 + 61c5703 commit 33e8daa
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions R/standardise_sumstats_column_headers_crossplatform.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#' @return list containing sumstats_dt, the modified summary statistics data
#' table object
#' @export
#' @importFrom data.table setnames rbindlist
#' @importFrom data.table setnames rbindlist setDF
#' @examples
#' sumstats_dt <- data.table::fread(system.file("extdata", "eduAttainOkbay.txt",
#' package = "MungeSumstats"))
Expand All @@ -24,7 +24,17 @@ standardise_header <- standardise_sumstats_column_headers_crossplatform <-
mapping_file = sumstatsColHeaders,
uppercase_unmapped=TRUE,
return_list=TRUE) {


data.table::setDF(mapping_file)
if(!all.equal(
mapping_file,
sumstatsColHeaders
)) {
message(
"Non-standard mapping file detected.",
"Making sure all entries in `Uncorrected` are in upper case.")
mapping_file$Uncorrected <- toupper(mapping_file$Uncorrected)
}
message("Standardising column headers.")
message("First line of summary statistics file: ")
msg <- paste0(names(sumstats_dt), split = "\t")
Expand Down

0 comments on commit 33e8daa

Please sign in to comment.