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

Error creating an actorNetwork #39

Closed MonchoCastro closed 4 years ago

MonchoCastro commented 4 years ago

When I try to network with the actors in a video, people who comment and their responses, I get the following error:

Generating youtube actor network...Error: x must be a vector, not a tbl_df/tbl/data.frame/datasource/youtube object.

I review the code and write it in different ways but for the moment i am getting this. How can i fix it? The code is the following one:

library(vosonSML)
library(devtools)

apikey <- "xxxxxxx"
key <- Authenticate("youtube", 
                    apiKey=apikey)

video = c("2GRs1HKaLnA)  #Example

actorNetwork <- Authenticate("youtube", apiKey = apikey) %>%
                Collect(videoIDs = video) %>%
                Create("actor", writeToFile = TRUE)

As I said I tried different ways:

youtubeData <- youtubeAuth %>%
               Collect(videoIDs = video, maxComments = 500, writeToFile = TRUE)

#Note that if you read the YouTube dataframe from disk, you will need to modify the class values for the object, before you can use it with vosonSML:

youtubeData <- readRDS("/path/to/data/data.rds")
class(youtubeData) <- append(class(youtubeData), c("datasource", "youtube"))

actorNetwork <- youtubeData %>% Create("actor") %>% AddText(youtubeData)

Anyone could help me please??

thank you very much!

bryn-g commented 4 years ago

Hi,

Thank you for your message. This error is caused by recent breaking changes in the dplyr package version 1.0 that now requires a different order of custom classes attached to dataframes. We've fixed this in the latest development version of vosonSML that you can install from github using devtools or remotes.

devtools::install_github("vosonlab/vosonSML")

Apologies the example from the vignette probably needs an update as well. It's probably easier to use ImportData rather than readRDS. So after updating you should be able to simply enter:

youtubeData <- ImportData("/path/to/data/data.rds", "youtube")
actorNetwork <- youtubeData %>% Create("actor") %>% AddText(youtubeData)

Please let me know if you have any further issues.

MonchoCastro commented 4 years ago

Hi,

Thank you for your message. This error is caused by recent breaking changes in the dplyr package version 1.0 that now requires a different order of custom classes attached to dataframes. We've fixed this in the latest development version of vosonSML that you can install from github using devtools or remotes.

devtools::install_github("vosonlab/vosonSML")

Apologies the example from the vignette probably needs an update as well. It's probably easier to use ImportData rather than readRDS. So after updating you should be able to simply enter:

youtubeData <- ImportData("/path/to/data/data.rds", "youtube")
actorNetwork <- youtubeData %>% Create("actor") %>% AddText(youtubeData)

Please let me know if you have any further issues.

Thank you very much! Now it works perfectly!