I am trying to split a date column of the format Y-M-D
into three separate columns, e.g. I want to convert
0001-01-01
into
0001 01 01
It seems it should be straightforward to split by "-" but the strsplit
function won't work as this is numeric data. Converting to character does not seem to work either. Would the grep
function work here?
Sorry if this seems a straightforward question. I have trawled through similar problems for half an hour and can't find a simple solution here.
Many thanks.