Tweets JSON转换为Excel

Tweets JSON转换为Excel,json,r,twitter,Json,R,Twitter,我正在尝试转换我的JSON文件(这是一个带有流式API的tweet捕获。有50.000个寄存器),但由于这个字符“/n”,这是不可能的。(看看这个例子:) 每次我尝试可视化我的数据时,都会出现换行(因为/n),我无法处理我的数据。。。 我希望有可能通过清除所有信息来轻松过滤我的数据 这是我使用的代码 setwd(); file <- "myfile.json" # as json object mytweets<-readTweets("myfile") # as dataframe

我正在尝试转换我的JSON文件(这是一个带有流式API的tweet捕获。有50.000个寄存器),但由于这个字符“/n”,这是不可能的。(看看这个例子:) 每次我尝试可视化我的数据时,都会出现换行(因为/n),我无法处理我的数据。。。 我希望有可能通过清除所有信息来轻松过滤我的数据

这是我使用的代码

setwd();
file <- "myfile.json"
# as json object
mytweets<-readTweets("myfile")
# as dataframe
tweets.df <- parseTweets("myfile", simplify = FALSE)
setwd();

文件而不是图像,您能直接在问题中添加myfile.json(我想)的内容吗?如果系统不允许,您也可以使用。嗨!,很抱歉,这里有与de JSON数据的链接:我应该补充这个问题(很抱歉,我之前忘记提及),我想将数据转换为Excel文件,因为我必须使用Infogr.am制作图表,我需要更清晰的数据。提前谢谢!当你在readTweets中声明它时,它不应该是“文件”(不带引号)而不是“myfile”吗?你可以直接在问题中添加myfile.json(我想)的内容而不是图像吗?如果系统不允许,你也可以使用。嗨!对不起,这里有反json数据的链接:我应该添加到这个问题中(很抱歉,我之前忘了提到)我想将数据转换为Excel文件,因为我必须使用Infogr.am制作图表,我需要我的数据更清晰。提前感谢!当你在readTweets中声明时,它不应该是“文件”(不带引号)而不是“我的文件”吗?
write.csv2(df, tf <- tempfile(fileext = ".csv"), row.names = F)
shell.exec(tf) # open file on windows machine, where .csv is associated with excel
df <- structure(list(text = c("RT @louane: Oui @Solidays sera la prochaine date à Paris ! \nmais d'abord @Zenith_Paris ce soir et demain encore !! <ed><U+00A0><U+00BD><ed><U+00B4><U+00A5><ed><U+00A0><U+00BD><ed><U+00B2><U+00A5> https://.../Pf8yNp56…", 
"EgyptAir Jet Disappears Over Mediterranean Sea https://.../SW2yWp6RrG https://.../0xeWSBZlvI", 
"RT @morandiniblog: EN DIRECT - Paris et Le Caire expriment \"leurs condoléances\" aux familles des victimes du crash du vol MS804 https://t.c…"
), retweet_count = c(25, 0, 4), favorited = c(FALSE, FALSE, FALSE
), truncated = c(FALSE, FALSE, FALSE), id_str = c("733225923248566272", 
"733225923621867520", "733225924385247232"), in_reply_to_screen_name = c(NA_character_, 
NA_character_, NA_character_), source = c("<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", 
"<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>", 
"<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>"
), retweeted = c(FALSE, FALSE, FALSE), created_at = c("Thu May 19 09:20:57 +0000 2016", 
"Thu May 19 09:20:57 +0000 2016", "Thu May 19 09:20:57 +0000 2016"
), in_reply_to_status_id_str = c(NA_character_, NA_character_, 
NA_character_), in_reply_to_user_id_str = c(NA_character_, NA_character_, 
NA_character_), lang = c("fr", "en", "fr"), listed_count = c(33, 
0, 1), verified = c(FALSE, FALSE, FALSE), location = c("Udine ITALY", 
"Instagram: dimple_90s", "Bordeaux "), user_id_str = c("2703557176", 
"2169023166", "865179050"), description = c("NEW VIDEO,NEWS,CHARTS,SPORTS,\nFASHION,ONLY OFFICIAL PAGES..", 
"20. Watford/3rd Year UoW.", "je veux désormais conserver que les moments de bonheur  <U+2728>             communication - Bordeaux"
), geo_enabled = c(TRUE, TRUE, TRUE), user_created_at = c("Sat Jul 12 15:06:22 +0000 2014", 
"Fri Nov 01 20:16:38 +0000 2013", "Sat Oct 06 19:23:29 +0000 2012"
), statuses_count = c(11283, 7481, 20834), followers_count = c(1909, 
305, 140), favourites_count = c(155920, 2413, 2019), protected = c(FALSE, 
FALSE, FALSE), user_url = c(NA_character_, NA_character_, NA_character_
), name = c("MUSIC news!", "George The Mermaid<U+264A><U+FE0F>", 
"Laura"), time_zone = c(NA, NA, "Paris"), user_lang = c("it", 
"en", "fr"), utc_offset = c(NA, NA, 7200), friends_count = c(354, 
278, 329), screen_name = c("barreca51", "GeorgiaWalker95", "laulylove"
), country_code = c(NA_character_, NA_character_, NA_character_
), country = c(NA_character_, NA_character_, NA_character_), 
    place_type = c(NA_character_, NA_character_, NA_character_
    ), full_name = c(NA_character_, NA_character_, NA_character_
    ), place_name = c(NA, NA, NA), place_id = c(NA, NA, NA), 
    place_lat = c(NaN, NaN, NaN), place_lon = c(NaN, NaN, NaN
    ), lat = c(NA_real_, NA_real_, NA_real_), lon = c(NA_real_, 
    NA_real_, NA_real_), expanded_url = c("https://twitter.com/justemoi2013/status/733173507023069184", 
    "http://news.sky.com/story/1698511/egyptair-jet-disappears-over-mediterranean-sea", 
    "http://www.jeanmarcmorandini.com/article-353767-en-direct-disparition-du-vol-paris-le-caire-l-avion-s-est-ecrase-au-large-de-l-ile-grecque-de-karpathos-dans-l-espace-aerien-egyptien.html"
    ), url = c("https://.../Pf8yNp56Th", "https://.../SW2yWp6RrG", 
    "https://.../hok65e82pV")), .Names = c("text", "retweet_count", 
"favorited", "truncated", "id_str", "in_reply_to_screen_name", 
"source", "retweeted", "created_at", "in_reply_to_status_id_str", 
"in_reply_to_user_id_str", "lang", "listed_count", "verified", 
"location", "user_id_str", "description", "geo_enabled", "user_created_at", 
"statuses_count", "followers_count", "favourites_count", "protected", 
"user_url", "name", "time_zone", "user_lang", "utc_offset", "friends_count", 
"screen_name", "country_code", "country", "place_type", "full_name", 
"place_name", "place_id", "place_lat", "place_lon", "lat", "lon", 
"expanded_url", "url"), row.names = c(NA, 3L), class = "data.frame")