# [R] marketing-questionnaire with split-design

Norbert Dörrer norbert at doerrer.at
Tue Sep 9 16:42:11 CEST 2014

```Dear Experts

I'm quite new to the world of R; so maybe my question is kind of
beginners...

I am right now trying to analyse questionnaire data (CAWI) for producing a
image/positioning map of the competitors of my company; when programming
the CAWI, a split design was needed; every respondent had to answer a
couple of multiple-choice questions (on reputation of company, image,
sympathy etc.; 1 "perfect" to 5 "absolutely not perfect") for two companies
only - out of a list of several companies; companies were chosen randomly.

So what I have now is two variables that tell me which two companies the
respondent was actually evaluating...
Company 1:      A, B, C, D, E, F or G
Company 2:      A, B, C, D, E, F or G

... and of course several image-related variables:
reputation of company 1:  3,4,2,3,5,1,2,3,4,2,3,1,5 and so on
reputation of company 2:  5,2,3,4,2,5,1,2,3,2,4,21 and so on
image of company 1:        2,4,3,5,2,3,4,1,2,5,3,4,2 and so on
image of company 2:        3,4,5,2,5,4,5,3,4,2,5,1,2 and so on
sympathy of company 1:  1,5,3,4,2,5,3,4,1,2,3,4,5 and so on
sympathy of company 2:   5,5,4,5,3,3,4,3,3,3,4,2,5 and so on
etc.

But what I need in order to do proper calculations is one
Reputation/Image/Sympathy-Variable for every single company, like this:
reputation of Company A: e.g. 3,4,3,5,NA,3,NA,5,2,1,NA,NA
reputation of Company B: e.g. NA,4,3,5,NA,3,NA,5,2,1,NA
reputation of Company C and so on
image of Company A:...
image of Company B :...
image of Company C and so on
sympathy of Company A:...
sympathy of Company B :...
sympathy of Company C and so on

So I need some syntax to compute a new variable  e.g. "reputation_CompanyA"
that contains the values of "reputation of company 1" whenever "Company
1"=A and that contains the values of "reputation of company 2" whenever
"Company 2"=A... else is of course missing values!

The solution has to has something to do with loops and flow control, but I
really can't solve this puzzle.

Thanks for your help and best regards
Norbert

[[alternative HTML version deleted]]

```