From 6ac8222598b5366619158f5e6bbf592116c94e1a Mon Sep 17 00:00:00 2001 From: Thomas OBADIA <tobadia@pasteur.fr> Date: Mon, 14 Feb 2022 14:52:18 +0100 Subject: [PATCH] Force reading Excel MFI input as text columns for to prevent bugs with pivot_long() use mixing together sample/antigen names (character) and MFI values (numbers). --- FUNCTIONS.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FUNCTIONS.R b/FUNCTIONS.R index 95318d2..906d6a6 100644 --- a/FUNCTIONS.R +++ b/FUNCTIONS.R @@ -136,7 +136,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM endcount_row_number <- which(L_full$xPONENT == "Avg Net MFI") # Load Excel file - L <- as.data.frame(read_excel(fname1, skip = median_row_number+1)) + L <- as.data.frame(read_excel(fname1, skip = median_row_number+1, col_types = "text")) ## Find all blank rows (i.e. rows that are all NA). ## Then keep rows preceding the first blank row. @@ -165,7 +165,7 @@ runRelativeAntibodyUnits = function(fname1, fname2, MFI_CSV, MFI_N_ANTIGENS, TEM # MFI values as numeric L[,-which(colnames(L) %in% c("Location","Sample","Total Events","TotalEvents"))] = lapply(L[,-which(colnames(L) %in% c("Location","Sample","Total Events"))], as.numeric) - C <- as.data.frame(read_excel(fname1, skip = count_row_number+1)) + C <- as.data.frame(read_excel(fname1, skip = count_row_number+1, col_types = "text")) ## Find all blank rows (i.e. rows that are all NA). ## Then keep rows preceding the first blank row. -- GitLab