Hi:
Assuming dd is the name of your data frame,
> dd$diff <- with(dd, q2 - q1)
> dd
TIME ID q1 q2 diff
1 1 1187 3 2 -1
2 1 1706 3 3 0
3 1 1741 2 4 2
4 2 1187 3 2 -1
5 2 1706 3 3 0
6 2 1741 2 4 2
is one way to do it.
HTH,
Dennis
On Mon, Feb 21, 2011 at 11:05 AM, Vlatka Matkovic Puljic <
v.matkovic.puljic@gmail.com> wrote:
> Dear all,
>
> I want to perform paired Wilcoxon signed ranks test on my data.
> I have pairs defined by ID and TIME variables.
>
> How can I calculate difference in variables q1, q2 in each pair?
>
> TIME ID q1 q2
> 1 1187 3 2
> 1 1706 3 3
> 1 1741 2 4
> 2 1187 3 2
> 2 1706 3 3
> 2 1741 2 4
>
> Please, any clue!
> :)
>
>
> --
> **************************
> Vlatka Matkovic Puljic
> +32/ 485/ 453340
>
> [[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.
>
[[alternative HTML version deleted]]