[R] Primer for working with survey data in R

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Sat Nov 11 23:35:03 CET 2017


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 <kevin683 at gmail.com> 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]]
>
>______________________________________________
>R-help at r-project.org 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.



More information about the R-help mailing list