But I get the following error,
Error in pullsg(XXXXXXX, api_key, completes_only = TRUE, clean = TRUE) :
could not find function "pullsg"
Have downloaded these packages (knitr, devtools, dplyr, httr, shiny, tidyr, ggplot2, stringr, zoo, forcats,tidyverse and Rsurveygizmo)
Have also tried;
api_key <- "XXXXXX";
gizmo_response <- pullsg(XXXXX, api_key, completes_only=TRUE, clean=TRUE) but on execution same error 'function pullsg not found'.
In addition to installing packages, you need to load or attach them each time you use them in a new session using a library() call. In this case, it looks like pullsg() is a function inside Rsurveygizmo, so you'd need library(Rsurveygizmo).
Also, R is case-sensitive. So, Rsurveygizmo is not the same as rsurveygizmo. I think you might be right in this case, but it's something to look out for (I'm not sure why, but the GitHub repo for that package seems not to match the declared package name).
I talked to SurveyGizmo tech support about something related to this a while ago.
It's my understanding that rsurveygizmo, developed by DerekYves, was written based on an old version of the SurveyGizmo API. SurveyGizmo doesn't support the R package directly but it can be updated in GitHub. I would encourage anybody to update it to the most recent version of the SurveyGizmo API!
@kendalwolf I did think about this possibility and have contacted SurveyGizmo for the same but have not heard back from them yet. Could you please share further details of how you solved your issue.
Thank you so so much !
Yeah a 401 Error means you're unauthorized, so either your credentials aren't valid, or, as @kendalwolf suggests, this could be working off of an old API — meaning your credentials aren't working because they're for the wrong API. https://httpstatuses.com/401
I solved the issue by exporting my SurveyGizmo survey results to a CSV. Then I imported them into R using something like data = read.csv("surveygizmo.csv", header = TRUE)
@kendalwolf Well we are using latest SurveyGizmo API hence I can't really figure out where the error lies. For now we are exporting through CSV but it would have been great if this code worked as it was working well until a few weeks ago.
Thank you so much for your input and time!
@internp The rsurveygizmo package needs to be modified on GitHub. It makes calls to SurveyGizmo's API using commands that apply to an old version of the API. If you're good at coding R packages, I recommend that you update the rsurveygizmo package and upload the fix to GitHub.