Primer for working with survey data in R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Primer for working with survey data in R

Kevin Taylor
I am taking a behavioral stats graduate class and the instructor is using
SPSS. I'm trying to follow along in R.

Recently in class we started working with scales and survey data, computing
Cronbach's Alpha, reversing values for reverse coded items, etc.

Also, SPSS has some built in functionality for entering the meta-data for
your survey, e.g. the possible values for items, the text of the question,
etc.

I haven't been able to find any survey guidance for R other than how to run
the actual calculations (Cronbach's, reversing values).

Are there tutorials, books, or other primers, that would guide a newbie
step by step through using R for working with survey data? It would be
helpful to see how others are doing these things. (Not just how to run the
mathematical operations but how to work with and manage the data.) Possibly
this would be in conjunction with some packages such as Likert or Scales.

TIA.

--Kevin

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

Bert Gunter-2
Dunno. But ...

1. Web Search (eg on "Survey tutorials using R" and similar)

2. R's survey package, which includes vignettes.

3. CRAN Task View:  https://cran.r-project.org/web/views/SocialSciences.html


HTH.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sat, Nov 11, 2017 at 11:56 AM, Kevin Taylor <[hidden email]> wrote:

> I am taking a behavioral stats graduate class and the instructor is using
> SPSS. I'm trying to follow along in R.
>
> Recently in class we started working with scales and survey data, computing
> Cronbach's Alpha, reversing values for reverse coded items, etc.
>
> Also, SPSS has some built in functionality for entering the meta-data for
> your survey, e.g. the possible values for items, the text of the question,
> etc.
>
> I haven't been able to find any survey guidance for R other than how to run
> the actual calculations (Cronbach's, reversing values).
>
> Are there tutorials, books, or other primers, that would guide a newbie
> step by step through using R for working with survey data? It would be
> helpful to see how others are doing these things. (Not just how to run the
> mathematical operations but how to work with and manage the data.) Possibly
> this would be in conjunction with some packages such as Likert or Scales.
>
> TIA.
>
> --Kevin
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

David Winsemius
In reply to this post by Kevin Taylor

> On Nov 11, 2017, at 11:56 AM, Kevin Taylor <[hidden email]> wrote:
>
> I am taking a behavioral stats graduate class and the instructor is using
> SPSS. I'm trying to follow along in R.
>
> Recently in class we started working with scales and survey data, computing
> Cronbach's Alpha, reversing values for reverse coded items, etc.
>
> Also, SPSS has some built in functionality for entering the meta-data for
> your survey, e.g. the possible values for items, the text of the question,
> etc.
>
> I haven't been able to find any survey guidance for R other than how to run
> the actual calculations (Cronbach's, reversing values).
>
> Are there tutorials, books, or other primers, that would guide a newbie
> step by step through using R for working with survey data? It would be
> helpful to see how others are doing these things. (Not just how to run the
> mathematical operations but how to work with and manage the data.) Possibly
> this would be in conjunction with some packages such as Likert or Scales.

Try looking at:

http://personality-project.org/r/psych/

--
David.

>
> TIA.
>
> --Kevin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

Jeff Newmiller
In reply to this post by Kevin Taylor
You really should have pointed out that you cross-posted this question [1] so we wouldn't repeat things. You were already pointed at the task view on this subject there. Be sure to look for vignettes in the relevant packages.

I cannot point you to domain-specific examples, though I came across some in the brief search I did that lead me to your redundant question, so you probably ought to clarify what you have looked at and why it wasn't helpful.

You mention specifying possible values... I will point out that many people turn off the automatic conversion to factor when reading categorical data, instead converting those columns to factors explicitly using the factor function:

dta$cat1 <- factor( dta$cat1, levels=c( "democrat", "republican", "libertarian", "independent", "other" ) )

There is also a package that focuses on factors ("forcats") that may have functions in it useful to your work.

I would put actual questions in a separate data frame with the question numbers and use the merge function if/when needed... but this is not my usual working area... some dedicated packages might put that info into attributes.

[1] https://stats.stackexchange.com/questions/313220/doing-survey-analysis-in-r
--
Sent from my phone. Please excuse my brevity.

On November 11, 2017 11:56:50 AM PST, Kevin Taylor <[hidden email]> wrote:

>I am taking a behavioral stats graduate class and the instructor is
>using
>SPSS. I'm trying to follow along in R.
>
>Recently in class we started working with scales and survey data,
>computing
>Cronbach's Alpha, reversing values for reverse coded items, etc.
>
>Also, SPSS has some built in functionality for entering the meta-data
>for
>your survey, e.g. the possible values for items, the text of the
>question,
>etc.
>
>I haven't been able to find any survey guidance for R other than how to
>run
>the actual calculations (Cronbach's, reversing values).
>
>Are there tutorials, books, or other primers, that would guide a newbie
>step by step through using R for working with survey data? It would be
>helpful to see how others are doing these things. (Not just how to run
>the
>mathematical operations but how to work with and manage the data.)
>Possibly
>this would be in conjunction with some packages such as Likert or
>Scales.
>
>TIA.
>
>--Kevin
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

Fox, John
In reply to this post by Kevin Taylor
Dear Kevin,

In addition to the advice you've received, take a look at the survey package. It's not quite what you're asking for, but in fact it's probably more useful, in that it provides correct statistical inference for data collected in complex surveys. The package is described in an article,  T. Lumley (2004), Analysis of complex survey samples, Journal of Statistical Software 9(1): 1-19, and a book, T. Lumley, Complex Surveys: A Guide to Analysis Using R, Wiley, 2010, both by the package author.

I hope that this helps,
 John

> -----Original Message-----
> From: R-help [mailto:[hidden email]] On Behalf Of Kevin Taylor
> Sent: Saturday, November 11, 2017 2:57 PM
> To: [hidden email]
> Subject: [R] Primer for working with survey data in R
>
> I am taking a behavioral stats graduate class and the instructor is using SPSS.
> I'm trying to follow along in R.
>
> Recently in class we started working with scales and survey data, computing
> Cronbach's Alpha, reversing values for reverse coded items, etc.
>
> Also, SPSS has some built in functionality for entering the meta-data for your
> survey, e.g. the possible values for items, the text of the question, etc.
>
> I haven't been able to find any survey guidance for R other than how to run the
> actual calculations (Cronbach's, reversing values).
>
> Are there tutorials, books, or other primers, that would guide a newbie step by
> step through using R for working with survey data? It would be helpful to see
> how others are doing these things. (Not just how to run the mathematical
> operations but how to work with and manage the data.) Possibly this would be
> in conjunction with some packages such as Likert or Scales.
>
> TIA.
>
> --Kevin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

David Winsemius

> On Nov 11, 2017, at 2:36 PM, Fox, John <[hidden email]> wrote:
>
> Dear Kevin,
>
> In addition to the advice you've received, take a look at the survey package. It's not quite what you're asking for, but in fact it's probably more useful, in that it provides correct statistical inference for data collected in complex surveys. The package is described in an article,  T. Lumley (2004), Analysis of complex survey samples, Journal of Statistical Software 9(1): 1-19, and a book, T. Lumley, Complex Surveys: A Guide to Analysis Using R, Wiley, 2010, both by the package author.

Although the same thought occurred to me after reading the initial question, I decided against suggesting the survey package. I consulted the recommended book above and it has none of the requested statistics. It is designed for surveys that use complex sampling designs requiring weighting the observations. I also consulted the Social Sciences Task View and it seemed unhelpful for the specific requests. It seemed likely to me that even a graduate course in behavioral statistics would be focussed on the sorts of questions that the psych package delivers. The  website maintained by Revelle has several tutorials that include developed examples using R to deliver the requested measure. Obviously "reversing values" is something that would require learning basic R manipulation of factor variables.

--
David.

>
> I hope that this helps,
> John
>
>> -----Original Message-----
>> From: R-help [mailto:[hidden email]] On Behalf Of Kevin Taylor
>> Sent: Saturday, November 11, 2017 2:57 PM
>> To: [hidden email]
>> Subject: [R] Primer for working with survey data in R
>>
>> I am taking a behavioral stats graduate class and the instructor is using SPSS.
>> I'm trying to follow along in R.
>>
>> Recently in class we started working with scales and survey data, computing
>> Cronbach's Alpha, reversing values for reverse coded items, etc.
>>
>> Also, SPSS has some built in functionality for entering the meta-data for your
>> survey, e.g. the possible values for items, the text of the question, etc.
>>
>> I haven't been able to find any survey guidance for R other than how to run the
>> actual calculations (Cronbach's, reversing values).
>>
>> Are there tutorials, books, or other primers, that would guide a newbie step by
>> step through using R for working with survey data? It would be helpful to see
>> how others are doing these things. (Not just how to run the mathematical
>> operations but how to work with and manage the data.) Possibly this would be
>> in conjunction with some packages such as Likert or Scales.
>>
>> TIA.
>>
>> --Kevin
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

Michael Dewey-3
In reply to this post by Kevin Taylor
Dear Kevin

The nearest equivalent to the SPSS VALUE LABELS is the labels in
factor(). If you want to attach labels to a whole question like VARIABLE
LABELS then you may want to use an attribute using attr()

Michael

On 11/11/2017 19:56, Kevin Taylor wrote:

> I am taking a behavioral stats graduate class and the instructor is using
> SPSS. I'm trying to follow along in R.
>
> Recently in class we started working with scales and survey data, computing
> Cronbach's Alpha, reversing values for reverse coded items, etc.
>
> Also, SPSS has some built in functionality for entering the meta-data for
> your survey, e.g. the possible values for items, the text of the question,
> etc.
>
> I haven't been able to find any survey guidance for R other than how to run
> the actual calculations (Cronbach's, reversing values).
>
> Are there tutorials, books, or other primers, that would guide a newbie
> step by step through using R for working with survey data? It would be
> helpful to see how others are doing these things. (Not just how to run the
> mathematical operations but how to work with and manage the data.) Possibly
> this would be in conjunction with some packages such as Likert or Scales.
>
> TIA.
>
> --Kevin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: Primer for working with survey data in R

Albin Blaschka-5
In reply to this post by Kevin Taylor
Am 11.11.2017 20:56, schrieb Kevin Taylor:

>    Also, SPSS has some built in functionality for entering the
> meta-data for
>    your survey, e.g. the possible values for items, the text of the
> question,
>    etc.


Hello!
Maybe the sjmisc together with the sjplot package are helpful -
specially the first one has explicitly functions for labeled data in the
sense of SPSS...

http://www.strengejacke.de/sjPlot/sjmisc/
https://strengejacke.wordpress.com/sjplot-r-package/

HTH,
Albin


--
| Dr.rer.nat. Albin Blaschka
| Etrichstrasse 26, A-5020 Salzburg
| * www.standortsanalyse.net *
| * www.researchgate.net/profile/Albin_Blaschka *
| - It's hard to live in the mountains, hard but not hopeless!

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.