ソースを参照

better default simplification of tweets columns

master
親
コミット
17e10f27a3
2個のファイルの変更、27行の追加、26行の削除
  1. +1
    -1
      DESCRIPTION
  2. +26
    -25
      R/tweet_io.R

+ 1
- 1
DESCRIPTION ファイルの表示

@@ -1,6 +1,6 @@
Package: gathertweet
Title: Gather Tweets from the Command Line with rtweet
Version: 0.0.1.9000
Version: 0.0.1.9001
Authors@R:
person(given = "Garrick",
family = "Aden-Buie",

+ 26
- 25
R/tweet_io.R ファイルの表示

@@ -93,32 +93,33 @@ simplify_tweets <- function(
if (length(.fields)) {
tweets %>% dplyr::select(!!!.fields)
} else {
dplyr::select(
tweets,
created_at,
status_id,
user_id,
screen_name,
text,
is_quote,
is_retweet,
favorite_count,
retweet_count,
hashtags,
profile_url,
profile_image_url,
urls_expanded_url,
mentions_screen_name,
media_url,
urls_url,
ext_media_url,
status_url,
dplyr::starts_with("reply_to_"),
quoted_status_id,
retweet_status_id,
quoted_status_id,
dplyr::starts_with("mentions_"),
tw_cols <- names(tweets)
keep_cols <- c(
"created_at",
"status_id",
"user_id",
"screen_name",
"text",
"is_quote",
"is_retweet",
"favorite_count",
"retweet_count",
"hashtags",
"profile_url",
"profile_image_url",
"urls_expanded_url",
"mentions_screen_name",
"media_url",
"urls_url",
"ext_media_url",
"status_url",
grep("^reply_to_", tw_cols, value = TRUE),
"quoted_status_id",
"retweet_status_id",
"quoted_status_id",
grep("^mentions_", tw_cols, value = TRUE)
)
tweets[, intersect(tw_cols, keep_cols)]
}
}


読み込み中…
キャンセル
保存