I have a data structure as below. As can be seen there are some columns that have numbers separated by a colon. For these, I'd like to retain only the maximum value. Example, for record 1 the expected output is 15 and for record 5 it should be 142. I considered using split function, however, this will create additional columns which I wouldn't want as I need to retain the column structure.
dat <- structure(list(X1 = list(1:15), X2 = list(106L), X3 = list(134L),
X4 = list(139L), X5 = list(141:142)), class = "data.frame", row.names = c(NA,
-1L))
Expected output
X1 X2 X3 X4 X5
15 106 134 139 142