Let\'s have a dataframe with long strings in one column:
df<-data.frame(short=rnorm(10,0,1),long=replicate(10,paste(rep(sample(letters),runif(1,5,8)),collaps
This is one way:
within(df, { long = paste(substr(long, 1, 10), "...", sep = "") })
I use substr to get the first part of the string, than I use paste for the "...". To permanently change the characters in df, simply do:
df = within(df, { long = paste(substr(long, 1, 10), "...", sep = "") })