post_tweet: Posts status update to user's Twitter account

Description Usage Arguments See Also Examples

Description

Posts status update to user's Twitter account

Usage

1
2
post_tweet(status = "my first rtweet #rstats", media = NULL, token = NULL,
  in_reply_to_status_id = NULL)

Arguments

status

Character, tweet status. Must be 140 characters or less.

media

File path to image or video media to be included in tweet.

token

OAuth token. By default token = NULL fetches a non-exhausted token from an environment variable tokens.

in_reply_to_status_id

Status ID of tweet to which you'd like to reply. Note: in line with the Twitter API, this parameter is ignored unless the author of the tweet this parameter references is mentioned within the status text.

See Also

Other post: post_favorite, post_follow, post_friendship

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
x <- rnorm(300)
y <- x + rnorm(300, 0, .75)
col <- c(rep("#002244aa", 50), rep("#440000aa", 50))
bg <- c(rep("#6699ffaa", 50), rep("#dd6666aa", 50))
tmp <- tempfile(fileext = "png")
png(tmp, 6, 6, "in", res = 127.5)
par(tcl = -.15, family = "Inconsolata",
    font.main = 2, bty = "n", xaxt = "l", yaxt = "l",
    bg = "#f0f0f0", mar = c(3, 3, 2, 1.5))
plot(x, y, xlab = NULL, ylab = NULL, pch = 21, cex = 1,
     bg = bg, col = col,
     main = "This image was uploaded by rtweet")
grid(8, lwd = .15, lty = 2, col = "#00000088")
dev.off()
browseURL(tmp)
post_tweet(".Call(\"oops\", ...)",
           media = tmp)

# example of replying within a thread
post_tweet(status="first in a thread")
my_timeline <- get_timeline(self_user_name, n=1, token=twitter_token)
reply_id <- my_timeline[1,]$status_id
post_tweet(status="second in the thread", in_reply_to_status_id=reply_id)

## End(Not run)

ashoksiri/rtweet documentation built on May 8, 2019, 5:55 p.m.