Qualtrics Suvrveys - Pipe text the variable name selected - qualtrics

I am able to display the selected response but not the variable name given to the response. I am not able to find an option in qualtrics that lets you pipe in the variable name given to a response. Has anyone done this before?
For example, I have a survey of 15 Yes or no questions. For some questions, "Yes" is a favorable answer and for some "No" is the favorable answer. To avoid confusions in the final report, i have added a variable name to the responses as favorable response and unfavorable response. At the end of each survey, I have added a summary page that shows the responses chosen so far in a table. To add better clarity, I would like to display the responses selected in this summary page as the variable name selected i.e, "favorable" or "unfavorable" rather than "Yes" or "No".
Is there a way to pipe text the variable name selected in Qualtrics? Please advise.

Thanks for the clarification. No, there is no way to pipe the recode variable names.
You can assign embedded data variables corresponding to each question with the values "favorable" or "unfavorable" in the survey flow using branches.

Related

R Studio "filter" function question. Filtering out items that do not contain a certain value

I have a dataset with two columns of interest, one a "Response" column (where participants in a task could respond through typing what they believed a presented image was - so the class being a "character" for their responses). The second column is an "Image" column (containing the name of the actual image presented).
What I would like to do is see how many of the Responses do not match what the image actually was. As there are multiple words participants can characterise and name an object, I would also like to have several options for what is acceptable for the response to be. What I have done so far is to try and use the filter function for each of the 300 images that have been presented, including all responses to the presentation of one individual image and all responses to that image that contain the word that is correct. See below:
Image1CorrectAnswers <- data %>% filter(data$Image == "Image1.jpg", data$Response == "bike")
What I was wondering however, is 1) whether it is possible to use the filter function for responses that do not contain the correct word for that specific image? 2) As well as whether I can have multiple different "acceptable" words to "filter" out correct responses from the incorrect ones (as different participants can answer differently to the same image, and yet both be correct). The goal is to have a final variable for each of the 300 images containing only the incorrect responses.
Thank you in advance.
If I understood correctly, you need to determine which rows in your dataset have the "Response" column match the "Image" column, right?
Well, considering your "Image" column is a filename (say, ending with .jpg), maybe you could split/remove the file extension. Thus, you could directly find out which rows are correctly labeled (response = Image)
Say,
correct_responses <- data$Response %in% strsplit(data$Image, ".jpg")
This way you can acess the correct and incorrect rows by doing:
correct_data <- data[correct_responses, ]
incorrect_data <- data[!correct_responses, ]

Unfiltering in R to mutate a variable in a data frame

I have a data set of open-answer responses in a survey. I have a set of topics that I want to assign to these open answer responses according to the content of the people's responses to a given question.
I want to specify keywords and search for a match to these keywords (/strings) for a specific variable (in this case, the variable is a question asked). Importantly, these strings can only be a partial match to the responses, I'm just specifying keywords that will appear at some point in the string. For example, filtering the responses by those that use the word 'money' at some point in their response to a given question. Given the matched rows, I want to assign a "1" to those rows in a new variable, let's call it "Topic1".
I have this code:
df %>%
filter(str_detect(var, "money|cash|revenue|profit")) %>%
mutate(Topic1 = "1")
This code works fine to filter and create the new variable according to the conditions I specify. However, if I assign back to the dataframe, I have now subsetted the entire dataframe according to my filter. I would like to filter the rows by my provided keywords, create the new variable, then 'unfilter' the dataframe, and assign the result back to the df.
I'm wondering if there is an 'unfilter' that I can use to reselect all my data. OR perhaps there is a better solution with ifelse?

Assigning observation name to a value when retrieving a variable

I want to create a dataframe that contains > 100 observations on ~20 variables. Now, this will be based on a list of html files which are saved to my local folder. I would like to make sure that are matches the correct values per variable to each observation. Assuming that R would use the same order of going through the files for constructing each variable AND not skipping variables in case of errors or there like, this should happen automatically.
But, is there a "save way" to this, meaning assigning observation names to each variable value when retrieving the info?
Take my sample code for extracting a variable to make it more clear:
#Specifying the url for desired website to be scrapped
url <- 'http://www.imdb.com/search/title?
count=100&release_date=2016,2016&title_type=feature'
#Reading the HTML code from the website
webpage <- read_html(url)
title_data_html <- html_text(html_nodes(webpage,'.lister-item-header a'))
rank_data_html <- html_text(html_nodes(webpage,'.text-primary'))
description_data_html <- html_text(html_nodes(webpage,'.ratings-bar+ .text-
muted'))
df <- data.frame(title_data_html, rank_data_html,description_data_html)
This would come up with a list of rank and description data, but no reference to the observation name for rank or description (before binding it in the df). Now, in my actual code one variable suddenly comes up with 1 value too much, so 201 descriptions but there are only 200 movies. Without having a reference to which movie the description belongs, it is very though to see why that happens.
A colleague suggested to extract all variables for 1 observation at a time and extend the dataframe row-wise (1 observation at a time), instead of extending column-wise (1 variable at a time), but spotting errors and clean up needs per variable seems way more time consuming this way.
Does anyone have a suggestion of what is the "best practice" in such a case?
Thank you!
I know it's not a satisfying answer, but there is not a single strategy for solving this type of problem. This is the work of web scraping. There is no guarantee that the html is going to be structured in the way you'd expect it to be structured.
You haven't shown us a reproducible example (something we can run on our own machine that reproduces the problem you're having), so we can't help you troubleshoot why you ended up extracting 201 nodes during one call to html_nodes when you expected 200. Best practice here is the boring old advice to LOOK at the website you're scraping, LOOK at your data, and see where the extra or duplicate description is (or where the missing movie is). Perhaps there's an odd element that has an attribute that is also matching your xpath selector text. Look at both the website as it appears in a browser, as well as the source. Right click, CTL + U (PC), or OPT + CTL + U (Mac) are some ways to pull up the source code. Use the search function to see what matches the selector text.
If the html document you're working with is like the example you used, you won't be able to use the strategy you're looking for help with (extract the name of the movie together with the description). You're already extracting the names. The names are not in the same elements as the descriptions.

Can I pipe text from an external source into a questoin, based on a response to a previous questoin?

[sorry about the title- can't use the word 'question']
I'm trying to take the response from a previous question and use it to look up a matched value in an external data set, then display the matched value as piped text in a following question.
For instance, if question 1 has choices (A, B, C, and D),
and my data set contains (A=1, B=2, C=3, D=4),
can I pipe the number into question 2, based on the letter selected in question one?
I have a rough idea about how I could do this by adding some javascript but I'd like to stick to the native Qualtrics features if possible. Can this be done using embedded data or contact lists in Qualtrics?
Your simple example could be done by manually including the data set in to qualtrics survey flow as branches.
You could also do this by recoding the values of each answer and piping in selected choices recode value.
Alternatively you could create a webservice to receive your answer and return the corresponding number.

filter by variable value in report block

I could find no relevant answers in either StackOverflow or google. Perhaps one of you has the answer. This is a continuation from a previous question...
In Business Objects Webi, I have two variables. One dimension, one measure. My goal is to create a simple pie chart.
Here's the dimension variable titled "EWFMCodeSelect":
`=If([Code]InList("BRK1"; "BRK2"; "BRK3" )) Then"BREAK"
ElseIf([Code]InList("TEAM"; "MTG"; "MTNG"; "PROJ"; "TRNG";"WCGB")) Then "DISC"
ElseIf([Code]InList("LUNCH")) Then "LUNCH"
ElseIf([Code]InList("LATE";"NOSHOW";"UNPAID";"UPVAC")) Then "MISS"
ElseIf([Code]InList("COACH";"VTO")) Then "NEUTR"
ElseIf([Code]InList("VAC";"LOA";"SICKUP";"SICKPL")) Then "NODISC"
ElseIf([Code]InList("PREP")) Then "OTHER"
ElseIf([Code]InList("OVER")) Then "OVER"
Else("SHIFT")`
This is the measure variable titled EWFMPieChart(%):
=[TimeDiff (ToInt)]
/ NoFilter(( Sum([TimeDiff (ToInt)]
ForAll([EWFMCodeSelect])
Where ([EWFMCodeSelect] = "SHIFT")))ForEach())
The previous advice I received was to filter the value "SHIFT" from the report block. I thought this would be a simple affair but it's proving more difficult than anticipated. I tried creating a Report Block filter in the Analysis tab "EWFMCodeSelect Not Equal To SHIFT"
"EWFMCodeSelect Not In List > SHIFT"
but only ended up with a single row, the dimension field empty, the measure field showing #MULTIVALUE. I tried a variety of other combinations but all had the same effect.
I tried a Column filter:
=[EWFMCodeSelect] Where ([EWFMCodeSelect] <> "SHIFT")
but ended up with a single row, the dimension field showing: "BREAKDISCLUNCH..." as the value and the measure, again, showing #MULTIVALUE.
I'm missing some important clue here. Can anyone educate me either why this approach is incorrect and maybe supply me with a direction to achieve my goal?
Thanks,
mfc
I don't have the correct answer but I did solve the problem by cleaning up all of the TEST variables, deleting all unused and unnecessary errata that collected up to this point and re-running the report as a scheduled item. I also cleared the browser cache (never bad advice).
After re-opening the report, I was able to filter the report block without issue.
I guess the answer is "When in doubt and receiving undocumented results, clean up your work-space and try again".

Resources