You can do this by capturing all characters except the last:
variables = c('B10243E1', 'B10243E2', 'B10243E3', 'B10243E4')
gsub('^(.*).$', '\\1', variables)
Explanation:
^ - beginning of line(.*) - All characters, but a new line before.$- last character (taken off .) to the end of the line ( $).
, , , .
:
[1] "B10243E" "B10243E" "B10243E" "B10243E"
( , T ):
variables = c('B10247E1T', 'B10243E2T', 'B10243E3T', 'B10243E4T')
gsub('^(.{7}).', '\\1', variables)
( ET , ):
[1] "B10247ET" "B10243ET" "B10243ET" "B10243ET"