This repository has been archived by the owner on Jun 30, 2023. It is now read-only.
purr::map<> ifelse(any(names(results)=="geo")),results,results$geo<-NA #337
Unanswered
carlaLanyon
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone!!!!
I'm trying to get the replies for the 19000 conversation id that is in another data frame with the function get_all_tweets. The results lead to my to several data frames some data frame are null, others have different columns etc. In order to pull together all this dataframe Im working with Map and with lists. Im particularly interest in have the author id, the geo and the conversation columns
Tweet_kiruna= 19270 elements with the following columns
[1] "author_id" "conversation_id" "id" "public_metrics"
[5] "created_at" "possibly_sensitive" "entities" "text"
[9] "geo" "source" "lang" "attachments"
[13] "in_reply_to_user_id" "referenced_tweets" "location"
Create an empty list to put together the different df from get all tweets.
out<-list()
query<- map(tweet_kiruna,build_query(conversation_id = tweet_kiruna$conversation_id[i]),
start_tweets = "2010-01-01T00:00:00Z",
end_tweets = "2022-01-01T00:00:00Z",
has_geo=NULL,
data_path = "pruba/",
bind_tweets=TRUE)
get_all_funcion=function(i){df<- get_all_tweets(build_query(conversation_id = tweet_kiruna_location$conversation_id[i]),
start_tweets = "2010-01-01T00:00:00Z",
end_tweets = "2022-01-01T00:00:00Z",
has_geo=NULL,
data_path = "pruba/",
bind_tweets=TRUE)
return(df)
}
out<-map(query,get_all_function)
I tried alone the function and the query worked perfectly, but the last map doesn't work and says:
Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, :
something went wrong. Status code: 400
In addition: Warning messages:
1: Tweets will be bound in local memory as well as stored as JSONs.
Any with the same issue or have used purr:: map? Any recommendation will be helpful!!
BEST
Beta Was this translation helpful? Give feedback.
All reactions