Replace extension '.bed'
sub_bed(path, replacement = "", stop_if_not_ext = TRUE)
String with extension '.bed'.
Replacement of '.bed'. Default replaces by nothing. Can be useful to replace e.g. by '.bim' or '.fam'.
If replacement != ""
, whether to error if
replacement is not an extension (starting with a '.').
String with extension '.bed' replaced by replacement
.
path <- "toto.bed"
sub_bed(path)
#> [1] "toto"
sub_bed(path, ".bim")
#> [1] "toto.bim"
sub_bed(path, ".fam")
#> [1] "toto.fam"
sub_bed(path, "_QC", stop_if_not_ext = FALSE)
#> [1] "toto_QC"