soubhikbarari / svmkr Goto Github PK
View Code? Open in Web Editor NEWR package for "full-stack" survey research with SurveyMonkey.
Home Page: http://soubhikbarari.com/svmkR/
License: Other
R package for "full-stack" survey research with SurveyMonkey.
Home Page: http://soubhikbarari.com/svmkR/
License: Other
Hello,
Is it possible to retrieve the language that a survey was taken in using the parse_survey()
function? That field is not included in the results by default and I cannot find any documentation about get_responses()
that would indicate what arguments should be included.
Thanks
Hello! I am trying to grab my survey object like so
fetch_survey_obj(surveyid) %>%
parse_survey()
But when I do such I get this error:
You have 494 requests left today before you hit the limit
+ Parsing questions ๐
=======Getting responses ๐ฃ
You have 493 requests left today before you hit the limit
Time difference of 0.852349 secs
Parsing responses โ
| | 0 % ~calculating
Error in surv_obj$answers[[answer$row_id]] :
attempt to select less than one element in get1index
To my understanding, this is a package issue but please let me know if I am misunderstanding the documentation somehow.
e.g. [[Template:12122:4]]
[[Split]]
s
upload_qdoc
can take a theme_id
parameter. It would be great if we could test out uploading the same survey using different theme IDs and seeing that this feature works.
It would also be great to know what the theme number is for our usual research insights surveys (check out one of our recent research team surveys and then try looking at the dev docs to see if theres a list of theme numbers or see if there's a theme number on the SurveyMonkey platform itself when creating a survey...).
If there is, it would be nice to have theme_id
in upload_qdoc
automatically set to that!
It would be nicer to have a more consistent interface for the survey downloading that mirrors the qdoc survey creation interface:
download_qdoc
: does what fetch_survey_obj()
does but turns into a qdoc objectdownload_responses
: takes either ID or qdoc (with ID parameter) and returns dataframe as parse_survey()
worksfetch_survey_obj
and parse_survey
Functionality:
keep.margins
and remove.margins
to keep/remove margins in the passed-in target
auto.map
option if it makes sense, i.e. allow user to turn off auto-mapping dataframe columns to population variablessave_target
Specific distributions to save out the target files in inst/extdata/targets
-- drawing from all the files we've created already from various projects -- and then also to turn into functions (in order of priority):
us_smallbiz_acs_23
(or something similar) for the small business weights that Zoe createdus_aapi_acs_19
(or something similar) for the weights we use for AAPI Datatx_acs_19
, ma_acs_19
, etc. etc. for each state gen popus_acs_teens_19
or something similar for US teens (these weights should be on the dashboard backend folders somewhere)Need to specify:
See svmkR_demo_0602.R
.
Not this again ...
Request from Zewei.
For example, we could add stars or bolden numbers within a particular block if they are significant in a pairwise test.
Will need to think through the exact design, generalizability, etc.
Duplicated questions issue arising for survey number 407853711
.
The SurveyMonkey research team has a set of standard variable coding practices. It would be great to institutionalize those into our R package.
For example, a function that looks for the usual SurveyMonkey Age question in the columns of a dataframe and then codes it into the Pew generations. Something like this (but accounts for present year):
svy_df$Age <- cut(as.numeric(svy_df$`What is your age?`),
breaks=c(-Inf, 26, 42, 59, Inf),
labels=c("18-26 (Gen-Z)","27-42 (Millennial)","43-58 (Gen X)","59+ (Boomer)"))
attr(svy_df$Income, "label") <- "Age (4) / Pew Generation" ## needed to show up in banners
A provisional list of such variables to code would be:
See 2022 procedures doc for more info
If a particular column in a multi-answer matrix question is never selected, it drops out of the dataset returned by parse_survey()
altogether.
Can either fix this in process_matrix()
or in the fetch_survey_obj()
stage (probably less work for current release to do the former).
Server returns a 504 error either immediately or after a little while.
format_date()
for start_created_at
in parse_survey()
Take tests in create_survey_tests.R
and format/copy over into /tests
.
We need to have some QDOC tag that the user can use to specify an explicit "Other" and "None of the above" options. Relevant code in make_survey.R
.
There's a way to specify this in the Developer API, just need to:
qdoc.question
be able to parse a particular tag (maybe a :Other
subtype) for Other and similarly for NOTAFor example, for the SVMK marriage season survey, there is (or was) a comment linking to the ideas document that, when downloading the doc as a .txt
file gets appended to the very end of the survey doc like so:
In read_qdoc
(parse_survey.R
), should check for any comments at the very end of the .txt
file in this footnote-y format if the user is reading a Google Doc.
See svmkR_demo_0602.R
as a reference.
Hi,
I have found an issue while reading response data from 'drop-down menu question type'.
In the dataframeSurvey
object, which mas a data-frame, there were no columns from the drop-down menu question type.
metaDataSurvey <- fetch_survey_obj(id)
dataframeSurvey <- parse_survey(metaDataSurvey)
Going through the code, I found the issue why it was not exporting:
fetch_survey_obj
the metadata of the form, particularly svy_obj$choices
and svy_obj$answers
(file fetch_survey.R
did not include the ids of the choices. That happened because the drop-down menu type of question has the choices nesteded inside the cols
.process_matrix
inside response_parsers.R
, the available options were insufficient to uniquely identify the options because it did not consider the col$id
. In drop-menu options, you get a single answer for each row and each column. Therefore, you need three identifiers (row_id
, col_id
and question_id
). In process_matrix
function, there were only two identificas (row_id
and question_id
). Note: The choice_id is not necessarily a identifier because only one option per drop-down menu is allowed and therefore the question_id
would be an answer.To fix this issue, I did the following (and forked the main repo):
for
loop where it looks for cols in answers and add all col_ids and choice_ids accordingly. This added the missing ids to the answers and choices objects.# Line 53 of fetch_survey_obj.R
if ("cols" %in% names(question$answers)) {
for (col in question$answers$cols) {
answers[[col$id]] <- trimws(col$text)
if ("choices" %in% names(col)){
for(choice in col$choices){
answers[[choice$id]] <- trimws(choice$text)
choices[[question$id]] <- c(choices[[question$id]], answers[[choice$id]])
}
}
}
}
if
type in process_matrix
to parse "menu"
(drop-down menu subtype) and create the three ids colnames as the three ids for unique identification.# Line 32 of response_parsers.R
} else if (subtype == 'menu') {
question_text = paste0(surv_obj$questions[[question_id]], " - ", surv_obj$answers[[answer$row_id]], " - ", surv_obj$answers[[answer$col_id]])
col_id = paste0(question_id, "_", answer$row_id, "_", answer$col_id)
answer_text = surv_obj$answers[[answer$choice_id]]
out_named[[question_text]] <- answer_text
out_id[[col_id]] <- answer_text
These changes solved my issue. If forked those changes in case you want to commit these changes.
Thank you,
Felippe
It would be nice if read_qdoc
provided some more precise and easily readable warnings / error messages when a question is malformed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.