0

I've been having a lot of trouble using the "fromJSON" command. I'm trying to collect instagram data using their API, and this command isn't working. I'm using R and I have both packages for converting JSON to R installed, but I keep getting the following error: Error: could not find function "fromJSON"

I use R Studio and R 3.2.2 for Windows 8 x64. I tried searching and couldn't find a solution. Any help would be appreciated.

lmo
  • 37,904
  • 9
  • 56
  • 69
DrumNTech
  • 1
  • 1
  • 1
  • 1
    Have you tried [jsonlite](https://cran.r-project.org/web/packages/jsonlite/index.html), which also has a `fromJSON()`? – Ken Benoit Sep 27 '15 at 18:24
  • @KenBenoit yep...I tried that one as well. I'm not sure what's going on. I read somewhere that RStudio had problems like these sometimes, but I tried it directly in the R console, and same issue. I also tried them one at a time by uninstalling the others in case there was some conflict...but still nothing. – DrumNTech Sep 27 '15 at 18:36
  • I've had similar problems with Twitter data, often because the formatting can use some deep nesting or have some unusually formatted wrappers added by third parties working with the data. Maybe useful to examine the JSON directly and see if you can get some to work, to isolate the problem. – Ken Benoit Sep 27 '15 at 18:55

2 Answers2

3

If you just installed the package, try rjson::fromJSON() instead of just fromJSON()

user2063329
  • 443
  • 2
  • 5
  • 15
1

Installing the package alone doesn't suffice. You need to load the library too... Use library(rjson) or library(RJSONIO) or ... depending on which package you prefer, before calling any functions in it.

WhiteViking
  • 3,146
  • 1
  • 19
  • 22