Replace words in a tweet with numeric value of their frequency

Hello @Pingi ,
I think I understand your problem.
Because you did not provide a reprex (always much appreciated) I created one where my small freq data.frame takes the place of your 18420 words dataset.
If you want to change the format to the one with [ and ] you can use

tweetchar = paste("[",tweetnum$nr,"]",sep='',collapse = ' ')
tweetchar
[1] "[Inf] [2] [3] [Inf]"
>