I've been given a datafile where one of the fields (columns) is called code_id. Some of the codes in this field include "22K..", "22K4.", and "22K7.". Now I'm trying to subset a data.table to pull out the rows containing explicit values 22K.., and no others. My first attempt, treats the "." as a wildcard for any character and thus I get all three. I've tried several permutations of "escaping" the . using single or double \ characters, both with and outwith quotation marks but nothing seems to work. I guess I'm trying to stop R treating . as a wildcard and get it to treat it as a literal ".". What basic syntax am am I missing. The code attempted is :
K22Kcodes <- ClinicalTable[code_id == "22K.."]
Thx. J