You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor: migrate from magrittr pipe (%>%) to native R pipe (|>)
- Replace all instances of %>% with |> across R/, vignettes/, and tests/
- Remove magrittr from DESCRIPTION Imports
- Delete obsolete R/utils-pipe.R and man/pipe.Rd files
- Update all vignettes to use native pipe operator
message(paste0("## proxy-SNP(s) for ", length(unique(proxies$target_snp.outcome)), " missing-SNP(s) found; ", "proxy-SNP(s) for ", length(unique(as.factor(snps_reference))) - length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) not available (e.g., no proxy-SNP or r2 < provided)"))
804
804
805
805
# extract proxies from outcome ====
806
806
message(paste0("# 3. extracting proxy-SNP(s) from outcome"))
807
-
proxy_snps<-proxies%>%# select unique proxy SNPs to extract
808
-
dplyr::distinct(proxy_snp.outcome) %>%
807
+
proxy_snps<-proxies|># select unique proxy SNPs to extract
message(paste0("## proxy-SNP(s) for ", length(unique(as.factor(data_outcome_proxies$target_snp.outcome))), " of ", length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) extracted"))
835
835
836
836
# select proxy-SNP(s) with the highest R2 ====
837
-
data_outcome_proxies<-data_outcome_proxies%>%
838
-
dplyr::group_by(target_snp.outcome) %>%
839
-
dplyr::filter(R== max(R)) %>%
840
-
dplyr::slice(1) %>%
837
+
data_outcome_proxies<-data_outcome_proxies|>
838
+
dplyr::group_by(target_snp.outcome) |>
839
+
dplyr::filter(R== max(R)) |>
840
+
dplyr::slice(1) |>
841
841
dplyr::select(-R)
842
842
843
843
## Bind rows of data_outcome with data_outcome_proxies
@@ -912,7 +912,7 @@ proxy_search_split <- function(data_exposure, data_outcome, data_outcome_path, d
912
912
out= tempfile()
913
913
)
914
914
## format proxy data: change column order and names, add proxy.outcome = TRUE
915
-
proxies<-proxies%>%
915
+
proxies<-proxies|>
916
916
dplyr::select(
917
917
target_snp.outcome=SNP_A,
918
918
proxy_snp.outcome=SNP_B,
@@ -921,18 +921,18 @@ proxy_search_split <- function(data_exposure, data_outcome, data_outcome_path, d
921
921
proxy_a1.outcome=B1,
922
922
proxy_a2.outcome=B2,
923
923
R
924
-
) %>%
924
+
) |>
925
925
dplyr::mutate(
926
926
proxy.outcome=TRUE,
927
927
SNP=proxy_snp.outcome
928
-
) %>%
928
+
) |>
929
929
dplyr::select(proxy.outcome, dplyr::everything())
930
930
message(paste0("## proxy-SNP(s) for ", length(unique(proxies$target_snp.outcome)), " missing-SNP(s) found; ", "proxy-SNP(s) for ", length(unique(as.factor(snps_reference))) - length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) not available (e.g., no proxy-SNP or r2 < provided)"))
931
931
932
932
# extract proxies from outcome ====
933
933
message(paste0("# 3. extracting proxy-SNP(s) from outcome"))
934
-
proxy_snps<-proxies%>%# select unique proxy SNPs to extract
935
-
dplyr::distinct(proxy_snp.outcome) %>%
934
+
proxy_snps<-proxies|># select unique proxy SNPs to extract
message(paste0("## proxy-SNP(s) for ", length(unique(proxies$target_snp.outcome)), " missing-SNP(s) found; ", "proxy-SNP(s) for ", length(unique(as.factor(snps_reference))) - length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) not available (e.g., no proxy-SNP or r2 < provided)"))
1067
1067
1068
1068
# extract proxies from outcome ====
1069
1069
message(paste0("# 3. extracting proxy-SNP(s) from outcome"))
message(paste0("## proxy-SNP(s) for ", length(unique(as.factor(data_outcome_proxies$target_snp.outcome))), " of ", length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) extracted"))
1091
1091
1092
1092
# select proxy-SNP(s) with the highest R2 ====
1093
-
data_outcome_proxies<-data_outcome_proxies%>%
1094
-
dplyr::group_by(target_snp.outcome) %>%
1095
-
dplyr::filter(R== max(R)) %>%
1096
-
dplyr::slice(1) %>%
1093
+
data_outcome_proxies<-data_outcome_proxies|>
1094
+
dplyr::group_by(target_snp.outcome) |>
1095
+
dplyr::filter(R== max(R)) |>
1096
+
dplyr::slice(1) |>
1097
1097
dplyr::select(-R)
1098
1098
1099
1099
# format data and bind with original outcome data ====
@@ -1183,7 +1183,7 @@ proxy_search_UKB <- function(data_exposure, data_outcome, data_outcome_path, dat
1183
1183
out= tempfile()
1184
1184
)
1185
1185
## format proxy data: change column order and names, add proxy.outcome = TRUE
1186
-
proxies<-proxies%>%
1186
+
proxies<-proxies|>
1187
1187
dplyr::select(
1188
1188
target_snp.outcome=SNP_A,
1189
1189
proxy_snp.outcome=SNP_B,
@@ -1192,29 +1192,29 @@ proxy_search_UKB <- function(data_exposure, data_outcome, data_outcome_path, dat
1192
1192
proxy_a1.outcome=B1,
1193
1193
proxy_a2.outcome=B2,
1194
1194
R
1195
-
) %>%
1196
-
dplyr::mutate(proxy.outcome=TRUE) %>%
1195
+
) |>
1196
+
dplyr::mutate(proxy.outcome=TRUE) |>
1197
1197
dplyr::select(proxy.outcome, dplyr::everything())
1198
1198
message(paste0("## proxy-SNP(s) for ", length(unique(proxies$target_snp.outcome)), " missing-SNP(s) found; ", "proxy-SNP(s) for ", length(unique(as.factor(snps_reference))) - length(unique(as.factor(proxies$target_snp.outcome))), " missing-SNP(s) not available (e.g., no proxy-SNP or r2 < provided)"))
1199
1199
1200
1200
# extract proxies from outcome ====
1201
1201
message(paste0("# 3. extracting proxy-SNP(s) from outcome"))
0 commit comments