take 4 characters out a string of one column and put them in another column in r

main.r
# assuming your data frame is named df and the column with the string is called old_col

df$new_col <- substr(df$old_col, 1, 4)
128 chars
4 lines

related categories

gistlibby LogSnag