Bornin1992
Bornin1992

Reputation: 1

Regrouping Data for ANOVA

I have GPA data that I want to categorize in order to run ANOVA to test the significance of tutoring.

Basically, in one column, there are the hours of tutoring the student had and in the next column, there are the corresponding GPAs. I could not figure out how to create a table on this site, so I hope this description makes sense.

What I want is the GPAs of people with 0 hours to be in one column, the GPAs of people with > 0 < 6 hours in another column, and the GPAs of people with more than 6 hours in another column.

Then I would run an ANOVA test on those with 0 hours, those with less than 6 hours and those with over 6 hours of tutoring.

Can this be done using R?

Upvotes: 0

Views: 132

Answers (1)

IRTFM
IRTFM

Reputation: 263471

The way to do this in R is to construct a factor variable:

 dfrm$Hour.fc <- cut( dfrm$hours, c(0,6, Inf), include.lowest=TRUE)

The categories will be 0, 0 < X <=6, >6 since the default cut behavior is to have closed intervals on the right. . If you want 6 or greater to be the category bounds, then make the middle number 5.99. All of the ANOVA and regression functions are designed to handle factors.

Upvotes: 1

Related Questions