\begin{Schunk}
\begin{Sinput}
 anxiety2 <- reshape(anxiety, varying=c("anxiety1", "anxiety2", "anxiety3", "anxiety4"), 
  v.names = "anxiety", direction = "long")
 anxiety2 <- anxiety2[order(anxiety2$id, anxiety2$time), ]
 head(anxiety2, 15)
\end{Sinput}
\begin{Soutput}
    time  anxiety id
1.1    1 1.714286  1
1.2    2 1.500000  1
1.3    3 1.714286  1
1.4    4 1.928571  1
2.1    1 1.642857  2
2.2    2 1.642857  2
2.3    3 1.214286  2
2.4    4 1.928571  2
3.1    1 1.642857  3
3.2    2 2.000000  3
3.3    3 1.928571  3
3.4    4 1.857143  3
4.1    1 1.428571  4
4.2    2 1.857143  4
4.3    3 1.928571  4
\end{Soutput}
\end{Schunk}
