In base R:
# creating example dataframe
chr = (rep("Chr1",3))
refAllele = (rep("T",3))
altAllele = c("C", "C+G", "C+T")
otherAllele = c("A", "A", "T")
df = data.frame(chr = chr, refAllele= refAllele, altAllele = altAllele, otherAllele= otherAllele)
# subsetting dataframe based on the length of the altAllele: Insertion variants have nchar more than 1
noInsertionVar = df[nchar(df$altAllele) == 1,]
noInsertionVar
#chr refAllele altAllele otherAllele
#1 Chr1 T C A
insertionVar = df[nchar(df$altAllele) != 1,]
insertionVar
#chr refAllele altAllele otherAllele
#2 Chr1 T C+G A
#3 Chr1 T C+T T
Updating with tidyverse functions per the request in below comment:
insertionVar <- df %>% dplyr::filter(across(everything(), ~ str_detect(altAllele, "\\+")))
insertionVar
#chr refAllele altAllele otherAllele
#1 Chr1 T C+G A
#2 Chr1 T C+T T
noInsertionVar <- df %>% dplyr::filter(across(everything(), ~ !str_detect(altAllele, "\\+")))
#chr refAllele altAllele otherAllele
# 1 Chr1 T C A