mattroumaya / surveymonkey

Access your SurveyMonkey data directly from R!
https://mattroumaya.github.io/surveymonkey/
Other
42 stars 10 forks source link

parse_survey not working & sm_login() does not exist? #75

Closed wnfaulkner closed 2 years ago

wnfaulkner commented 2 years ago

Hello,

First, while I am a regular [R] user and have created my own packages, I am not as experienced with GitHub & issues, so I apologize if my comments miss the mark in any way. I am attempting to get set up using this package to connect directly to a client's data. I have their surveymonkey login info.

I have followed the Usage directions in the package ReadMe. Everything has worked up to parsing the survey into a data.frame (see screenshot).

Any help you can provide would be much appreciated!

surveymonkey parse_survey error screenshot

mattroumaya commented 2 years ago

Hi @wnfaulkner,

You shouldn't have to specify oauth_token for each call.

If you run usethis::edit_r_profile() in your console, your .Rprofile will pop up, and you can save the following:

options(sm_oauth_token = "YOUR_ACTUAL_OAUTH_TOKEN")

After saving the oauth token in your .Rprofile, you'll need to restart RStudio. This will allow the default arg oauth_token = getOption("sm_oauth_token") to work properly.

Then, you should be able to run the code you have above:

survey1.df <-
  308494268 %>%
  fetch_survey_obj() %>%
  parse_survey()

I hope this helps, and if not, please let me know and I'll be happy to keep troubleshooting.

wnfaulkner commented 2 years ago

Hello @mattroumaya,

Thank you so much for your reply!

I had followed those steps, but your reply helped me to check more thoroughly and I noticed that I had incorrectly specified options(sm_oath_token = "TOKEN") in my .rprofile file (as opposed to sm_oauth_token). Hence, my original note about the ReadMe was my own mistake. Once I fixed that, saved, and restarted R I no longer got the error.

I am now, unfortunately, dissecting a new error that parse_survey() is throwing, but I'm going to try to be as thorough with my diagnosis as possible to try to not waste your time.

Once again, thanks for the assistance!

mattroumaya commented 2 years ago

Thanks @wnfaulkner! Feel free to open an issue if you're running into something with parse_survey(). I've personally had a few issues with less common question types that might not be supported (yet!).

I'm going to close this one out, but again, feel free to create another thread if you run into any issues.