[R] Multiple selection and normalization

Rui Barradas ruipbarradas at sapo.pt
Tue Jun 4 13:21:00 CEST 2013


Hello,

A data example would be great. Try the following.

set.seed(71926)  # make up some data
dat <- data.frame(SIDN = 1:100,
		TERM = factor(sample(4, 100, TRUE)),
		GRADE = runif(100),
		INST = factor(sample(5, 100, TRUE)))

head(dat)

with(dat, ave(GRADE, list(TERM, INST), FUN = scale))


Hope this helps,

Rui Barradas

Em 03-06-2013 21:23, Robert Lynch escreveu:
> Hi--
>
> I am trying to normalize course grades for each instance of a course, e.g.
> Stats 1 Fall2009 J. Smith.
>
> I have a frame for all instances of a course, e.g. stats 1 in the last 5
> years, that looks like
>
> SIDN  TERM  GRADE  INST
>
> where SIDN is a Student ID Number, TERM is a factor that gives the quarter
> and year a course was offered, GRADE is a 0-4.3 grade and INST is the
> instructor, again as a factor.
>
> Course offerings are determined by the TERM and INST.  That is one inst.
> assigned grades to all the students they were responsible for that term.
>   Multiple instructors may have taught the same term.
>
> For every course offering I would like to normalize the GRADE:  Z<- (GRADE
> - mean)/SD  where the mean and SD are over a single course offering.
>
> Thanks!
> RBL
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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