Here is an R problem I am struggling with:
My dataset is organized like this...

subject       session        variable_x       variable_y
01                 1                    1            <interger values>
01                 1                    2
01                 1                    3
01                 2                    1
01                 2                    2
01                 2                    3
02                 1                    1
02                 1                    2
02                 1                    3
02                 2                    1
02                 2                    2
02                 2                    3
03                 1                    1
03                 1                    2
03                 1                    3
03                 2                    1
03                 2                    2
03                 2                    3
...

I need to find the level of variable x at which variable y has the maximum
value for each individual for each session. Then, I need to create another
variable, say variable "z" that labels that row in the dataset as the "max"
for that individual at that time. I have searched the archives and the web
for ideas, but am having trouble finding appropriate search terms for what
I need to do. Any advice? Thank you!!

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to