[R] first time poster

jdeisenberg catcode at catcode.com
Sun Mar 29 00:26:34 CET 2009



rilleyel wrote:
> 
> 
> i am trying to answer the following question, and having no luck:
> Focus your analysis on a comparison between respondents labeled “Low”
> (coded 1) on attend4 and respondents labeled “High” (coded 4). Then,
> examine the variance of distributions. That is, run a command "var.test".
> I feel like I need to recode somehow and create 2 new variables, one for
> the low responses, one for the high responses. I do not know how to 'get
> into' the variable to deal with just the answers...
> 
> 

I'm  not sure I understand what you want, but I'm guessing you have a data
frame with data like this, where the "attend4" column has the high or low
ratings, and you want to compare variances on some other variable (called
"score" in this example):

> d <- data.frame( attend4=c(1,4,1,1,4), score=c(20,30,21,22,24))
> d                                                              
  attend4 score                                                  
1       1    20                                                  
2       4    30                                                  
3       1    21                                                  
4       1    22                                                  
5       4    24

To separate the scores for people who had low scores vs. high scores, do
something like this:
> lows <- d$score[d$attend4 == 1]
> lows
[1] 20 21 22
> highs <- d$score[d$attend4 == 4]
> highs
[1] 30 24

Now you can do a var.test on lows vs. highs.

Hope this helps.

-- 
View this message in context: http://www.nabble.com/first-time-poster-tp22745190p22762547.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list