vosonlab / vosonSML

R package for collecting social media data and creating networks for analysis.
https://vosonlab.github.io/vosonSML/
GNU General Public License v3.0
78 stars 13 forks source link

Collect(<youtube>) and Collect(<thread.reddit>) throw an error in R4.4.0: object 'collect_log' not found #56

Closed sbinn closed 2 months ago

sbinn commented 4 months ago

On R 4.4.0 with vosonSML 0.34.2, Collect(<youtube>) and Collect(<thread.reddit>) throw the errors below, respectively:

Error in Collect.youtube(yt_auth, videoIDs = video_url, maxComments = 500, : object 'collect_log' not found

Error in Collect.thread.reddit(Authenticate("reddit"), threadUrls = thread_urls, : object 'collect_log' not found

Sample:

# YouTube Data Collection --------------------------------------------------
library(vosonSML)
my_api_key <- "XXX"
yt_auth <- Authenticate("youtube", apiKey = my_api_key)
video_url <- c("https://www.youtube.com/watch?v=jNQXAC9IVRw")
yt_data <- yt_auth |> Collect(videoIDs = video_url,
                              maxComments = 500,
                              writeToFile = TRUE,
                              verbose = TRUE) 

# Reddit Data Collection --------------------------------------------------
thread_urls <- c(
  "https://www.reddit.com/r/AusFinance/comments/ymkrlr/",
  "https://www.reddit.com/r/AusFinance/comments/ugetai/")
rd_data <- Authenticate("reddit") |>  
  Collect(threadUrls = thread_urls,
          sort = "best", 
          waitTime = c(6, 8),
          writeToFile = TRUE, 
          verbose = TRUE) 
bryn-g commented 4 months ago

Thanks @sbinn, this appears to be a new issue with R 4.4 and S3 classes and/or global variables as used with the metadata logging. It does not occur under R 4.3.

I've disabled the writeToFile metadata logging in vosonSML 0.34.3 commit d19d0a5 for the time being until the issue is determined and solved. You may still encounter the problems I have with Issue #58.

sbinn commented 3 months ago

Thanks for the commit. For YouTube, vosonSML 0.34.3 on R 4.4.0 fixes the issue for the Collect() function. However, it throws an error when trying to create an igraph object from a vosonSML network object:

_Error in Graph.actor.youtube(yt_actornetwork) : object 'g' not found

Sample (continuing example from above):

yt_actor_network <- yt_data |> Create("actor") |> Graph()

The error does not occur when using vosonSML 0.34.3 on R 4.3.2 or R 4.3.3.

Not tested for Reddit due to Issue #58 .

rjackland commented 2 months ago

@bryn-g already knows this, but I got the same as what @sbinn found: I also got the "object 'g' not found" error for vosonSML 0.34.3 on R 4.4.1 on Ubuntu 22.04, but it works fine with R 4.3.3

bryn-g commented 2 months ago

Error is fixed in 5fa70dc.