Format text in post_tweet command in rtweet package

67 views Asked by At

I am using the post_tweet functionality of the rtweet package in R.

It correctly has a 280 character limit, and will not post the tweet if the message length exceeds that.

However, I want to add some formatting to the tweet and the formatting items seem to be counted in the character limit. This is fine if the total number of characters is less than 280, but otherwise it won't post the tweet.

For example, if the text to post is

UK stats as of 19 Nov 2020 15:32 \n Cases rep'd on 19 Nov 2020=22915 \n Tests on 18 Nov 2020=367626 \n Deaths rep'd on 19 Nov 2020=501 \n Cases per 100k in w/e 14 Nov 2020 : Eng:273.4 (up 7.97%) NI:210.3 (down 0.3%) Scot':144.2 (down 6.46%) Wales:180.5 (down 20.43%) UK:256.6 (up 5.76%)

Then the number of characters is 290 and the command with this as the text in this:

post_tweet(<<<the text>>>) 

won't work. It is counting the line breaks (\n).

Anyone know of a way round this?

Many Thanks.

0

There are 0 answers