0

I'm trying to use the following code to parse a response from the Facebook API, and I get a strange error... below is the code and error... Any thoughts are greatly appreciated!

Link to code: How to get most popular Facebook post in R

The error I get is:

Error in myposts[[1]]$paging$"next" : $ operator is invalid for atomic vectors

Here is what the data looks like:

tail(myposts[[1]])

results in:

$paging

previous 
"https://graph.facebook.com/74133697733/posts?access_token=###token###&limit=25&since=1361736602&__previous=1" 

next

"https://graph.facebook.com/74133697733/posts?access_token=###token###&limit=25&until=1359727199" 
Community
  • 1
  • 1
Lauren
  • 57
  • 8

1 Answers1

0

It's because the paging element is a named vector, not a list, so you can't use $ to get sub-elements.

The following should work :

myposts[[1]]$paging["next"]
juba
  • 47,631
  • 14
  • 113
  • 118
  • Hi, thanks, that helps but it it looks like the while loop is still not recognizing the "next.path" text and using it to retrieve the next page of Json results... – Lauren Feb 25 '13 at 14:42
  • Maybe, but that's another question. – juba Feb 25 '13 at 14:47
  • Thanks, I've marked this question answered and here is the follow-on question: http://stackoverflow.com/questions/15072142/parsing-facebook-data-using-json – Lauren Feb 25 '13 at 16:56