005_twitteR_002

Document Sample
005_twitteR_002 Powered By Docstoc
					Package ‘twitteR’
July 24, 2009
Title R based Twitter client Description Provides an interface to the Twitter web API Version 0.1.0 Author Jeff Gentry <gentrj@gmail.com> Maintainer Jeff Gentry <gentrj@gmail.com> Depends RCurl, rjson, methods License LGPL Repository CRAN Date/Publication 2009-07-24 06:06:40

R topics documented:
directMessage-class dmGet . . . . . . . getUser . . . . . . initSession . . . . . publicTimeline . . Rtweets . . . . . . status-class . . . . updateStatus . . . . user-class . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 . 3 . 4 . 5 . 6 . 7 . 8 . 9 . 10 11

1

2

directMessage-class

directMessage-class Class "directMessage"

Description Provides a model representing direct messages (DMs) from Twitter Objects from the Class new(’directMessage’, text = [character], recipientSN = [character], created = [character], recipientID = [numeric], sender = [user], recipient = [user], senderID = [numeric], id = [numeric], senderSN = [character], ...) directMessage instances are usually created through calls to the dmGet function. Slots text: The text of the direct message recipientSN: Screen name of the recipient created: When this message was created recipientID: ID of the recipient sender: An object of class "user" representing the sender recipient: And object of class "user" representing the recipient senderID: The ID of the sender id: Internal ID of this message senderSN: Screen name of teh sender Methods show signature(object = "directMessage"): ... Author(s) Jeff Gentry See Also dmGet

dmGet

3

dmGet

Functions to manipulate Twitter direct messages

Description These functions allow you to interact with, send, and delete direct messages (DMs) in Twitter. Usage dmGet(session = getCurlHandle()) dmSent(session = getCurlHandle()) dmDestroy(dm, session = getCurlHandle()) dmSend(text, user, session = getCurlHandle()) Arguments text user dm session Value The dmGet and dmSent functions will return a list of directMessage objects. The former will retrieve DMs sent to the user while the latter retrieves messages sent from the user. The dmDestroy function takes a directMessage object (perhaps from either dmGet or dmSent) and will delete it from the Twitter server. The dmSend function will send a message to another Twitter user. Author(s) Jeff Gentry See Also directMessage Examples
## Not run: sess <- initSession('myuser', 'mypass') dms <- dmGet(sess) dms ## delete the first one dmDestroy(dms[[1]]) ## send a DM dmSend('Testing out twitteR!', 'twitter', sess)

The text of a message to send The user to send a message to, either character or an user object. The message to delete, an object of class directMessage A session object from initSession

4

getUser

## End(Not run)

getUser

Functions to manage Twitter users

Description These functions allow you interact with information about a Twitter user - retrieving their base information, list of friends, list of followers, and an up to date timeline. Usage getUser(user, session = getCurlHandle()) userFriends(user, session = getCurlHandle()) userFollowers(user, session = getCurlHandle()) Arguments user session Details These functions will only return fully formed objects if the authenticated user is allowed to see the requested user. If that person has a private account and has not allowed you to see them, you will not be able to extract that information. Value The getUser function returns an object of class user. The functions userFriends and userFollowers return lists of class user objects. Author(s) Jeff Gentry See Also initSession, mentions The Twitter user to detail, can be character or an user object. A session object from initSession

initSession Examples
## Not run: sess <- initSession('myuser', 'mypass') tuser <- getUser('twitter', sess) tfriends <- userFriends(tuser, sess) tfollowers <- userFollowers(tuser, sess) ttimeline <- userTimeline(tuser, sess) ## End(Not run)

5

initSession

A function to initiate a Twitter session

Description This function will initiate a web session for the user with the Twitter servers, providing a handle which is then used throughout the rest of the functions of twitteR. Usage initSession(username, password) Arguments username password Details As of now, twitteR still uses the old authentication method, and not OAuth. This function provides a CURLHandle which can then be passed along to any other function within the package in order to achieve proper authentication. Value An object of class CURLHandle Author(s) Jeff Gentry See Also getCurlHandle, dmGet, getUser Your Twitter screenname Your Twitter password

6 Examples
## Not run: sess <- initSession('myscreen', 'mypass') ## End(Not run)

publicTimeline

publicTimeline

Functions to view Twitter timelines

Description These functions will allow you to retrieve various timelines within the Twitter universe Usage publicTimeline(session=getCurlHandle()) userTimeline(user, session=getCurlHandle()) friendsTimeline(session=getCurlHandle()) mentions(session=getCurlHandle()) Arguments user session Details The userTimeline function will only properly operate if the authenticated user is allowed to see the requested user. The mentions function will return any statuses which mention the authenticated user. The friendsTImeline function will return the current timeline of the friends of the authenticated user. Value A list of status objects Author(s) Jeff Gentry See Also getUser, initSession, status The Twitter user to detail, can be character or an user object. A session object from initSession

Rtweets Examples
## Not run: sess <- initSession('myUser', 'myPasss') pt <- publicTimeline() pt mentions(sess) tw <- getUser('twitter', sess) userTimeline(tw, sess) ## End(Not run)

7

Rtweets

Retrieve latest R related tweets

Description This function will look at the #rstats hashtag and return status updates that are related to R Usage Rtweets(session = getCurlHandle()) Arguments session Details This is not a full featured search, but simply a hard coded search for the #rstats tag. A premade session is typically not going to be necessary, this command can be called without any parameters. However, if a user has access to a protected user’s timeline, they will not see any #rstat activity without using a session object. Value A list of status objects Author(s) Jeff Gentry See Also status A session object from initSession

8 Examples
## Not run: Rtweets() ## End(Not run)

status-class

status-class

Class to contain a Twitter status

Description Container for Twitter status messages, including the text as well as basic information Objects from the Class new(’status’, text = [character], favorited = [logical], replyToSN = [character], created = [character], truncated = [logical], replyToSID = [numeric], id = [numeric], replyToUID = [numeric], statusSource = [character], ...) These objects are typically constructed as a side effect from various functions, such as updateStatus. Slots text: Text of the status favorited: Whether the status is favorited replyToSN: Screen name that this is in reply to created: When this status was created truncated: Whether this status was truncated replyToSID: Reply to which status ID id: ID of the object replyToUID: Reply to which user ID statusSource: Source of the status message Methods show Displays information about the status text Returns the text of the status Author(s) Jeff Gentry See Also updateStatus, publicTimeline, friendsTimeline, userTimeline

updateStatus

9

updateStatus

Functions to manipulate Twitter status

Description These functions can be used to set or delete a user’s Twitter status Usage updateStatus(text, session = getCurlHandle()) deleteStatus(status, session = getCurlHandle()) Arguments text status session Details To delete a status message, pass in an object of class status, such as from the return value of updateStatus. Value The updateStatus function will return an object of class status. The deleteStatus returns TRUE on success and an error if failure occurs. Author(s) Jeff Gentry See Also initSession Examples
## Not run: sess <- initSession('myUser', 'myPass') ns <- updateStatus('this is my new status message', sess) ## ooops, we want to remove it! deleteStatus(ns) ## End(Not run)

The text to use for a new status An object of class status An object from initSession

10

user-class

user-class

A container object to model Twitter users

Description This class is designed to represent a user on Twitter, modeling information available Objects from the Class new(’user’, description = [character], statusesCount = [numeric], followersCount = [numeric], favoritesCount = [numeric], favoritesCount = [numeric], friendsCount = [numeric], url = [character], name = [character], created = [character], protected = [logical], verified = [logical], screenName = [character], location = [character], id = [numeric], lastStatus = [status], ...) Slots description: Description of the user statusesCount: Number of status messages the user has followersCount: Number of followers the user has favoritesCount: Number of favorites the user has friendsCount: The number of friends the user has url: URL associated with the user name: The user’s name created: When the user was created protected: Is the user protected? verified: Is the user verified? screenName: Screen name of the user location: Location of the user id: ID of the user lastStatus: A "status" object displaying the last status the user has posted Methods screenName Returns the screen name of the user show Displays basic information about the user Author(s) Jeff Gentry

Index
∗Topic classes directMessage-class, 1 status-class, 7 user-class, 9 ∗Topic interface dmGet, 2 getUser, 3 initSession, 4 publicTimeline, 5 Rtweets, 6 updateStatus, 8 buildDM (directMessage-class), 1 buildStatus (status-class), 7 buildUser (user-class), 9 deleteStatus (updateStatus), 8 directMessage, 2, 3 directMessage (directMessage-class), 1 directMessage-class, 1 dmDestroy (dmGet), 2 dmGet, 1, 2, 2, 5 dmSend (dmGet), 2 dmSent (dmGet), 2 friendsTimeline, 8 friendsTimeline (publicTimeline), 5 getUser, 3, 5, 6 initSession, 2, 3, 4, 4–6, 8, 9 mentions, 4 mentions (publicTimeline), 5 publicTimeline, 5, 8 Rtweets, 6 screenName (user-class), 9 11 screenName,user-method (user-class), 9 show,directMessage-method (directMessage-class), 1 show,status-method (status-class), 7 show,user-method (user-class), 9 showStatus (updateStatus), 8 status, 6–8 status (status-class), 7 status-class, 7 text,status-method (status-class), 7 twFromJSON (initSession), 4 updateStatus, 7, 8, 8 user, 2–5 user (user-class), 9 user-class, 9 userFollowers (getUser), 3 userFriends (getUser), 3 userTimeline, 8 userTimeline (publicTimeline), 5


				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:23
posted:8/23/2009
language:English
pages:11