\begin{Schunk}
\begin{Sinput}
 gpa2 <- reshape(gpa, direction = "long", 
             varying = list(paste0("job", 1:6), paste0("gpa", 1:6)), 
             v.names = c("job", "gpa"),  
             idvar = "student") 
 gpa2 <- gpa2[order(gpa2$student, gpa2$time), ]
 head(gpa2, 12)
\end{Sinput}
\begin{Soutput}
    student    sex highgpa admitted time     job gpa
1.1       1 female     2.8      yes    1 2 hours 2.3
1.2       1 female     2.8      yes    2 2 hours 2.1
1.3       1 female     2.8      yes    3 2 hours 3.0
1.4       1 female     2.8      yes    4 2 hours 3.0
1.5       1 female     2.8      yes    5 2 hours 3.0
1.6       1 female     2.8      yes    6 2 hours 3.3
2.1       2   male     2.5       no    1 2 hours 2.2
2.2       2   male     2.5       no    2 3 hours 2.5
2.3       2   male     2.5       no    3 2 hours 2.6
2.4       2   male     2.5       no    4 2 hours 2.6
2.5       2   male     2.5       no    5 2 hours 3.0
2.6       2   male     2.5       no    6 2 hours 2.8
\end{Soutput}
\end{Schunk}
