I am doing an analysis in r on tweets imported from a python script and have accidentally included the letter "b" before each tweet. It is the first character in one of the columns in the data frame. I have managed to clean up the tweets otherwise using the "stringr" package, does anyone know how to change this, in other words just get rid of the first character in the column usertweet? Here is some example code:
username = c("user1", "user2")
usertweet= c("b something", "b something something")
tweetsdf <-data.frame(username,usertweet)
We can use substring
tweetsdf$usertweet <- substring(tweetsdf$usertweet, 3)
Or use sub
sub("\\S+\\s+", "", tweetsdf$usertweet)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With