pablobarbera / Rfacebook

Dev version of Rfacebook package: Access to Facebook API via R
http://cran.r-project.org/web/packages/Rfacebook
350 stars 250 forks source link

{getPost() does not retrieve reactions' component} & {"reactions" and "likes" with the same logical value return neither error nor warning msg} #160

Open luanamarinho opened 6 years ago

luanamarinho commented 6 years ago

[Win 10; R 3.4.3; RStudio 1.1.383; Rfacebook 0.6.15]

Hi @pablobarbera !

I would like to point out two things, if I may:

1) Even though I have tried all possible combinations of the logical values for the arguments "comments", "reactions" and "likes", the best result I could get so far was a list of 3 components for each post ("post", "comments", and "likes") - that is, without the "reactions" component. Nevertheless, according to the package's documentation, "getPost returns a list with up to four components: post, likes, comments, and reactions." getPost

2) Besides the (somehow strange) fact that "reactions" should be FALSE (default) in order to retrieve info on the reactions to the post(s), I noticed a seemingly odd result: if I simultaneously set "reactions" and "likes" to be either TRUE or FALSE, R returns neither an error nor a warning message. The reason I find it a bit odd is because likes = !reactions in its own definition.

#packageVersion("Rfacebook")
#[1] ‘0.6.15'

# temporary access token
fb_oauth <- "my temporary user access token"

#pag_loop$id[1]
#[1] "242862559586_10156144461009587"

# Comments = T, likes = F, reactions = F, without api (default NULL)
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, comments = TRUE,
                            likes = FALSE, reactions = FALSE)
str(x)
# retrieves a list of 2 (comments and post)

#comments = T, likes = F, reactions = F, without api (default NULL)
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, comments = TRUE,
             likes = TRUE, reactions = TRUE)
str(x)
# retrieves a list of 2 (comments and post)

x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, comments = TRUE,
             likes = FALSE, reactions = TRUE, api = "v2.11") #did not run without api
str(x)
# retrieves a list of 2 (comments and post)

# arguments with default value (reactions =F, likes = T, comments = T, api = NULL)
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd)
str(x)
# retrieves a list of 3: posts, likes, comments

# default values for arguments comments, likes (except reactions)
# did not run without api
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, reactions = TRUE, api = "v2.11")
str(x)
# retrieves a list of 2: posts, comments

# default values for arguments comments, likes, and api (except reactions)
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, reactions = FALSE)
str(x)
# retrieves a list of 3: posts, likes, comments

# did not run without api
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, reactions = TRUE, api = "v2.11")
str(x)
# retrieves a list of 2: posts, comments

# api default
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, likes  = FALSE)
str(x)
# retrieves a list of 2: posts, comments

# api default
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, likes  = TRUE)
str(x)
# retrieves a list of 3: posts, likes, comments` 

# api default
x <- getPost(pag_loop$id[1], token = fb_oauth, n = qtd, likes  = TRUE)
str(x)
# retrieves a list of 3: posts, likes, comments

Therefore, could anyone please help me understand why the getPost function is behaving like that? Is there a problem in my code and/or in the function itself?

Best,

Luana

luanamarinho commented 6 years ago

Up