I am trying to add the time stamp after a 4-digit number (4 digits is year), I am currently using the following code:
temp.table[,"admission_datetime"] <- gsub("/2010$", "/2010 0:00:00", temp.table[,"admission_datetime"])
temp.table[,"admission_datetime"] <- gsub("/1976$", "/1976 0:00:00", temp.table[,"admission_datetime"])
temp.table[,"admission_datetime"] <- gsub("/1990$", "/1990 0:00:00", temp.table[,"admission_datetime"])
temp.table[,"admission_datetime"] <- gsub("/1978$", "/1978 0:00:00", temp.table[,"admission_datetime"])
The code works fine for me, but a bit clumsy and inflexible, I know I can use [0-9]{4} to capture the 1976,1978,1990,2010, but I don't know how to put them back using regex, can anyone enlighten me? Thanks.
\1\1thingy? thanks!