r - How to remove the 1st character of a string? -
this question has answer here:
please me removing first character column string variable ("t")?
> head(ecghr_long) id t ecg_hr 1 2003 t0 70 2 2004 t0 98 3 2008 t0 93 4 2010 t0 71 5 2018 t0 90 6 2019 t0 60
many
i replace letter part empty string:
as.numeric(sub('[a-za-z]', '', c('t0', 't1')))
the regular expression [a-za-z]
matches letters, , replaces ''
. as.numeric
casts result number.
Comments
Post a Comment