Created
November 19, 2011 14:23
-
-
Save abicky/1378880 to your computer and use it in GitHub Desktop.
patch for twitteR package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -cr twitteR.orig/R/base.R twitteR/R/base.R | |
*** twitteR.orig/R/base.R 2011-11-09 07:15:21.000000000 +0900 | |
--- twitteR/R/base.R 2011-11-19 23:29:19.000000000 +0900 | |
*************** | |
*** 1,7 **** | |
setRefClass('twitterObj', | |
contains='VIRTUAL', | |
methods = list( | |
! toDataFrame = function(row.names=NULL, optional=FALSE) { | |
fields <- names(.self$getRefClass()$fields()) | |
fieldList <- lapply(fields, function(x) { | |
val <- .self$field(x) | |
--- 1,7 ---- | |
setRefClass('twitterObj', | |
contains='VIRTUAL', | |
methods = list( | |
! toDataFrame = function(row.names=NULL, optional=FALSE, stringsAsFactors=FALSE) { | |
fields <- names(.self$getRefClass()$fields()) | |
fieldList <- lapply(fields, function(x) { | |
val <- .self$field(x) | |
*************** | |
*** 12,18 **** | |
}) | |
names(fieldList) <- fields | |
as.data.frame(fieldList, row.names=row.names, | |
! optional=optional) | |
} | |
) | |
) | |
--- 12,18 ---- | |
}) | |
names(fieldList) <- fields | |
as.data.frame(fieldList, row.names=row.names, | |
! optional=optional, stringsAsFactors=stringsAsFactors) | |
} | |
) | |
) | |
diff -cr twitteR.orig/R/comm.R twitteR/R/comm.R | |
*** twitteR.orig/R/comm.R 2011-11-17 08:39:16.000000000 +0900 | |
--- twitteR/R/comm.R 2011-11-19 23:29:19.000000000 +0900 | |
*************** | |
*** 201,207 **** | |
## epoch time, and then try a few data string formats | |
dateInt <- suppressWarnings(as.numeric(dateStr)) | |
if (!is.na(dateInt)) { | |
! posDate <- as.POSIXct(dateInt, origin='1970-01-01') | |
} else { | |
posDate <- as.POSIXct(dateStr, tz='UTC', | |
format="%a %b %d %H:%M:%S +0000 %Y") | |
--- 201,207 ---- | |
## epoch time, and then try a few data string formats | |
dateInt <- suppressWarnings(as.numeric(dateStr)) | |
if (!is.na(dateInt)) { | |
! posDate <- as.POSIXct(dateInt, tz='UTC', origin='1970-01-01') | |
} else { | |
posDate <- as.POSIXct(dateStr, tz='UTC', | |
format="%a %b %d %H:%M:%S +0000 %Y") | |
diff -cr twitteR.orig/R/dm.R twitteR/R/dm.R | |
*** twitteR.orig/R/dm.R 2011-11-09 07:15:21.000000000 +0900 | |
--- twitteR/R/dm.R 2011-11-19 23:29:19.000000000 +0900 | |
*************** | |
*** 37,44 **** | |
senderID <<- json[['sender_id']] | |
if (!is.null(json[['sender_screen_name']])) | |
senderSN <<- json[['sender_screen_name']] | |
! if (!is.null(json[['id']])) | |
! id <<- json[['id']] | |
} | |
callSuper(...) | |
}, | |
--- 37,44 ---- | |
senderID <<- json[['sender_id']] | |
if (!is.null(json[['sender_screen_name']])) | |
senderSN <<- json[['sender_screen_name']] | |
! if (!is.null(json[['id_str']])) | |
! id <<- json[['id_str']] | |
} | |
callSuper(...) | |
}, | |
*************** | |
*** 95,104 **** | |
if (!hasOAuth()) | |
stop("dmSend requires OAuth authentication") | |
if (inherits(user, "user")) | |
! user <- screenName(user) | |
if (nchar(text) > 140) | |
stop("Maximum of 140 chars may be sent via a direct message") | |
! params[['text']] <- text | |
res <- twInterfaceObj$doAPICall('direct_messages/new', | |
params=params, method='POST', ...) | |
dmFactory$new(res) | |
--- 95,108 ---- | |
if (!hasOAuth()) | |
stop("dmSend requires OAuth authentication") | |
if (inherits(user, "user")) | |
! uParams <- c(list(...)$uParams, list(screen_name = screenName(user))) | |
! else | |
! uParams <- parseUsers(user) | |
if (nchar(text) > 140) | |
stop("Maximum of 140 chars may be sent via a direct message") | |
! params <- c(list(...)$params, list(text = text)) | |
! params[['user_id']] <- uParams[['user_id']] | |
! params[['screen_name']] <- uParams[['screen_name']] | |
res <- twInterfaceObj$doAPICall('direct_messages/new', | |
params=params, method='POST', ...) | |
dmFactory$new(res) | |
diff -cr twitteR.orig/R/statuses.R twitteR/R/statuses.R | |
*** twitteR.orig/R/statuses.R 2011-11-09 07:15:21.000000000 +0900 | |
--- twitteR/R/statuses.R 2011-11-23 01:29:51.000000000 +0900 | |
*************** | |
*** 33,43 **** | |
} | |
if (!is.null(json[['text']])) | |
text <<- json[['text']] | |
! if (is.null(json[['favorited']])) | |
favorited <<- FALSE | |
else | |
favorited <<- TRUE | |
! if (is.null(json[['truncated']])) | |
truncated <<- FALSE | |
else | |
truncated <<- TRUE | |
--- 33,45 ---- | |
} | |
if (!is.null(json[['text']])) | |
text <<- json[['text']] | |
! if ((is.null(json[['favorited']])) || | |
! (json[['favorited']] == FALSE)) | |
favorited <<- FALSE | |
else | |
favorited <<- TRUE | |
! if ((is.null(json[['truncated']])) || | |
! (json[['truncated']] == FALSE)) | |
truncated <<- FALSE | |
else | |
truncated <<- TRUE | |
*************** | |
*** 50,63 **** | |
if ((!is.null(json[['in_reply_to_screen_name']])) && | |
(!is.na(json[['in_reply_to_screen_name']]))) | |
replyToSN <<- json[['in_reply_to_screen_name']] | |
! if ((!is.null(json[['in_reply_to_status_id']])) && | |
! (!is.na(json[['in_reply_to_status_id']]))) | |
! replyToSID <<- as.character(json[['in_reply_to_status_id']]) | |
! if ((!is.null(json[['in_reply_to_user_id']])) && | |
! (!is.na(json[['in_reply_to_user_id']]))) | |
! replyToUID <<- as.character(json[['in_reply_to_user_id']]) | |
! if (!is.null(json[['id']])) | |
! id <<- as.character(json[['id']]) | |
} | |
callSuper(...) | |
} | |
--- 52,65 ---- | |
if ((!is.null(json[['in_reply_to_screen_name']])) && | |
(!is.na(json[['in_reply_to_screen_name']]))) | |
replyToSN <<- json[['in_reply_to_screen_name']] | |
! if ((!is.null(json[['in_reply_to_status_id_str']])) && | |
! (!is.na(json[['in_reply_to_status_id_str']]))) | |
! replyToSID <<- as.character(json[['in_reply_to_status_id_str']]) | |
! if ((!is.null(json[['in_reply_to_user_id_str']])) && | |
! (!is.na(json[['in_reply_to_user_id_str']]))) | |
! replyToUID <<- as.character(json[['in_reply_to_user_id_str']]) | |
! if (!is.null(json[['id_str']])) | |
! id <<- as.character(json[['id_str']]) | |
} | |
callSuper(...) | |
} | |
diff -cr twitteR.orig/R/trends.R twitteR/R/trends.R | |
*** twitteR.orig/R/trends.R 2011-11-09 07:15:21.000000000 +0900 | |
--- twitteR/R/trends.R 2011-11-19 23:29:19.000000000 +0900 | |
*************** | |
*** 51,57 **** | |
buildTrend <- function(json, date) { | |
## we don't need to do the fancy twitter date mapping, this one is | |
## already ok | |
! trendFactory$new(json, as.POSIXct(date)) | |
} | |
setMethod('show', signature='trend', function(object) { | |
--- 51,57 ---- | |
buildTrend <- function(json, date) { | |
## we don't need to do the fancy twitter date mapping, this one is | |
## already ok | |
! trendFactory$new(json, as.POSIXct(date, tz='UTC')) | |
} | |
setMethod('show', signature='trend', function(object) { | |
diff -cr twitteR.orig/R/users.R twitteR/R/users.R | |
*** twitteR.orig/R/users.R 2011-11-09 10:10:49.000000000 +0900 | |
--- twitteR/R/users.R 2011-11-19 23:29:19.000000000 +0900 | |
*************** | |
*** 60,67 **** | |
verified <<- TRUE | |
if (is.character(json[['screen_name']])) | |
screenName <<- json[['screen_name']] | |
! if (!is.null(json[['id']])) | |
! id <<- as.character(json[['id']]) | |
if (!is.null(json[['location']])) | |
location <<- json[['location']] | |
} | |
--- 60,67 ---- | |
verified <<- TRUE | |
if (is.character(json[['screen_name']])) | |
screenName <<- json[['screen_name']] | |
! if (!is.null(json[['id_str']])) | |
! id <<- as.character(json[['id_str']]) | |
if (!is.null(json[['location']])) | |
location <<- json[['location']] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment