Hello useRs,

Is there a way to reverse values of 2 variables (like with the language
Python) ? :

a <- 1
b <- 2

a, b <- b, a

More specifically, I have a data frame :

   famnum generation germain1 germain2  fa  mo ptpn1 ptpn2 drb11 drb12
       1          2      200      201 101 102     1     1     1     1
       2          2      200      201 101 102     0     1     1     1
       3          2      200      201 101 102     1     0     1     1
...

I don't want "0" in the seventh column, so I would like to have :

   famnum generation germain1 germain2  fa  mo ptpn1 ptpn2 drb11 drb12
       1          2      200      201 101 102     1     1     1     1
       2          2      201      200 101 102     1     0     1     1
       3          2      200      201 101 102     1     0     1     1
...

I thought that a code like this would work :

if (ptpn1 == 0 & ptpn2 == 1)
  {
    germain1, germain2 <- germain2, germain1
    ptpn1, ptpn2 <- ptpn2, ptpn1
    drb11, drb12 <- drb12n, drb11
  }

But R is not Python... Is there a way to do it easyly ?

Thank you.
-- 
David

	[[alternative HTML version deleted]]

