I already read other questions but I still don't know how to parse Facebook Graph Search results in R. My main goal is to convert in something like a data frame, to analyze some columns.
library(RCurl)
library(RJSONIO)
library(rjson)
data <- getURL("https://graph.facebook.com/search?q=flamengo&type=post&limit=1000", cainfo="cacert.perm")
#if you don't have "cacert.perm" file, do as follow
#download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.perm")
UPDATE: Thanks @user1609452
Now what if I want to include "count", nested in "likes"? Let me show:
names(fbData$data[[1]])
[1] "id" "from" "message" "actions" "privacy"
[6] "type" "created_time" "updated_time" "shares" "likes"
names(fbData$data[[1]]$likes)
[1] "data" "count"
In this case, how sould I set match.fun argument?
likes <- lapply(fbData$data[[1]]$likes,name='count')
Error in match.fun(FUN) : no "FUN" argument, no pattern
likes <- lapply(fbData$data[[1]]$likes,'[[',name='count')
Error in FUN(X[[2L]], ...) : index out of bounds
Can someone help me, please?
And if I want to include "count", nested in "likes"? Let me show:
names(fbData$data[[1]])
[1] "id" "from" "message" "actions" "privacy"
[6] "type" "created_time" "updated_time" "shares" "likes"
names(fbData$data[[1]]$likes)
[1] "data" "count"
In this case, how sould I set match.fun argument?
likes <- lapply(fbData$data[[1]]$likes,name='count')
Error in match.fun(FUN) : no "FUN" argument, no pattern
likes <- lapply(fbData$data[[1]]$likes,'[[',name='count')
Error in FUN(X[[2L]], ...) : index out of bounds
Can someone help me, please?