We can use extract
library(tidyr)
extract(df, DATE, into=c('YEAR', 'MONTH', 'DAY'),
'(.{4})(.{2})(.{2})', remove=FALSE)
# DATE YEAR MONTH DAY PRCP
#1 19490101 1949 01 01 25
#2 19490102 1949 01 02 5
#3 19490118 1949 01 18 18
#4 19490119 1949 01 19 386
#5 19490202 1949 02 02 38
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…