Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_timeline -> changing the output a bit? #4

Closed
maelle opened this issue Aug 14, 2016 · 14 comments
Closed

get_timeline -> changing the output a bit? #4

maelle opened this issue Aug 14, 2016 · 14 comments

Comments

@maelle
Copy link
Member

maelle commented Aug 14, 2016

I'm currently using get_timeline and I've noticed it returns two data.frames now. For a package of mine (monkeylearn) I'd been advised to rather have only one data.frame as output with the other data.frame as attributes to the first one, so maybe in your case users could be an attribute of tweets so that it might be easier to deal with get_timeline output? It's just a suggestion of course, I find the function great already!

Moreover when retrieving 2000 tweets from realDonaldTrump the users data.frame contains 4 times the same line, should you add an unique-call somewhere?

@mkearney
Copy link
Collaborator

I'm currently using get_timeline and I've noticed it returns two data.frames now. For a package of mine (monkeylearn) I'd been advised to rather have only one data.frame as output with the other data.frame as attributes to the first one, so maybe in your case users could be an attribute of tweets so that it might be easier to deal with get_timeline output? It's just a suggestion of course, I find the function great already!

You wouldn't have any handy resources on this would you? I remember reading about ref classes and attributes in Hadley's book, but if you have any other recommendations I'll take them.

Moreover when retrieving 2000 tweets from realDonaldTrump the users data.frame contains 4 times the same line, should you add an unique-call somewhere?

This should now be fixed.

@maelle
Copy link
Member Author

maelle commented Aug 15, 2016

Sorry about the lack of details. I too learnt about attributes very recently. You'd just need to write attr(tweets, "users") <- users, because the data.frame can have any number of attributes without defining a class. ☺

@maelle
Copy link
Member Author

maelle commented Aug 15, 2016

ropensci/software-review#45 this is where I was told about attributes.

@mkearney
Copy link
Collaborator

@masalmon should be integrated now for search_tweets, get_timeline, and stream_tweets (next step will be to integrate with lookup_users). I also added users_data() and tweets_data() functions as shortcuts for attri(x, "users/tweets"). It's about the same amount of code, but it's easier for me at least to remember those over the attr call.

@mkearney
Copy link
Collaborator

If you try them out any time soon, let me know how it goes :)

@maelle
Copy link
Member Author

maelle commented Aug 17, 2016

Cool, thank you!

When I write djt <- get_timeline("realDonaldTrump", n = 20)

then the results data.frame has 19 empty lines, see picture below. Do you get this too?

rtweet

@mkearney
Copy link
Collaborator

Good call. There should only be 1 row there. I thought I fixed this, but it seems I overlooked something. Either way, I need to make sure my tests catch this as well.

@maelle
Copy link
Member Author

maelle commented Aug 17, 2016

And then you could add continuous integration, see e.g. http://juliasilge.com/blog/Beginners-Guide-to-Travis/ :-)

@mkearney
Copy link
Collaborator

Oh perfect! The section on Travis in Hadley's book seemed to assume people had a little more familiarity with it than I, so that gentle intro looks perfect! If it's not completely obvious, programming is a recent development for me. My background, and reason I started learning to code at all, is in statistics, so the help, as always, is very appreciated!

@maelle
Copy link
Member Author

maelle commented Aug 17, 2016

I'll tag @juliasilge so she can see the praise. 😸

And no it's not "completely obvious", you're doing great!

@bob-rietveld
Copy link

Hi, I tried to use the timeline function and got the following error. I also tried not parsing the results but it gave me the same error.

Thanks for your help!

djt <- get_timeline("realDonaldTrump", n = 20)

Error in as.POSIXct.default(rl_df$reset, origin = "1970-01-01") : 
  do not know how to convert 'rl_df$reset' to class “POSIXct”

@mkearney
Copy link
Collaborator

Are you using the Github or CRAN version of rtweet? Can you supply your sessionInfo() as well?

@mkearney mkearney reopened this Aug 28, 2016
@mkearney
Copy link
Collaborator

I'm having trouble replicating the error, but think I may have fixed it (at least, in the Github version). Let me know if you continue to have problems!

@bob-rietveld
Copy link

I tried the method in a different session and project and the error went away. So it's due to something in my R environment. I'lll dig some more but you can close the issue. Thanks for your response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants