Skip to content
This repository has been archived by the owner on Jun 30, 2023. It is now read-only.

bind_tweets function not working #341

Closed
4 of 5 tasks
psalmuel19 opened this issue Jul 28, 2022 · 2 comments
Closed
4 of 5 tasks

bind_tweets function not working #341

psalmuel19 opened this issue Jul 28, 2022 · 2 comments

Comments

@psalmuel19
Copy link

Please confirm the following

  • I have searched the existing issues
  • The behaviour of the program is deviated from what is described in the documentation.
  • I can reproduce this problem for more than one time.
  • This is NOT a 3-digit error -- it does not display an error message like something went wrong. Status code: 400.
  • This is a 3-digit error and I have consulted the Understanding API errors vignette and the suggestions do not help.

Describe the bug

Hi, I have used this code successfully until two days ago:
immersive_tech <- bind_tweets('data', user = FALSE, verbose = TRUE, output_format = "tidy")

Now I get this error:
Error in chr_as_locations():
! Can't rename columns that don't exist.
✖ Column id doesn't exist.

I tried it on an old query for which I already have the data to check if I missed something but it failed to bind the tweets upon finishing collection. I also tried output_format = "raw" but the columns it returns fewer than the standard output.

Full code below:
'tweets <-
get_all_tweets(
query = c("virtual reality africa"),
start_tweets = "2022-01-01T09:00:00Z",
end_tweets = "2022-06-30T09:00:00Z",
data_path = "data/",
context_annotations = FALSE,
bind_tweets = FALSE,
n = 200
)'

immersive_tech <- bind_tweets('data', user = FALSE, verbose = TRUE, output_format = "tidy")

Expected Behavior

function fails to bind tweets

Steps To Reproduce

Screenshot 2022-07-28 at 05 46 16

Environment

Error in chr_as_locations():
! Can't rename columns that don't exist.
✖ Column id doesn't exist.
Run rlang::last_error() to see where the error occurred.

Anything else?

No response

@psalmuel19 psalmuel19 changed the title bind_tweets function not bind_tweets function not working Jul 28, 2022
@TimBMK
Copy link
Contributor

TimBMK commented Aug 9, 2022

As I mentioned in #304 already, the fix is simple:

  1. Go to your data directory, i.e. where you stored the tweets for collection
  2. Find the .json files that lack an ID. They are named "data_.json" or "user_.json" ("user" only if you retrieved user data). These files are usually empty and are erroneously created when no data is returned for certain queries
  3. Delete the files "data_.json" / "user_.json" or move them to another directory
  4. Run bind_tweets on your data directory. The "tidy" format should work just fine now

We are working on fixing the issue by reorganising the data storage process. The error in the tidy format is caused by the empty files lacking the ID variable. Deleting them will not lose you any data, as they hold no information whatsoever.

Let me know if this works

@shmuhammadd
Copy link

@TimBMK This works for me. Thank you.

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

No branches or pull requests

4 participants