I'm trying to run this script:
input <- read.csv ("trio.csv")
for (i in 1:nrow(input)) {
  if (input[i, 6] == input[i, 2]) {
    if (input[i, 7] == input[i, 4] |
        input[i, 7] == input[i, 7]) {
      print ("h1")
    } else {
      print ("not h1")
    }
  } else if (input[i, 6] == input[i, 3]) {
    if (input[i, 7] == input[i, 4] | input[i, 7] == input[i, 7]) {
      print ("h1")
    } else {
      print ("not h1")
    }
  } else {
    print("not h1")
  }
}
for (j in 1:nrow(input)) {
  if (input[j, 7] == input[j, 2]) {
    if (input[j, 6] == input[j, 4] | input[j, 6] == input[j, 7]) {
      print ("h2")
    } else {
      print ("not h2")
    }
  } else if (input[j, 7] == input[j, 3]) {
    if (input[j, 6] == input[j, 4] |input[j, 6] == input[j, 7]) {
      print ("h2")
    } else {
      print ("not h2")
    }
  } else {
    print("not h2")
  }
}
The trio.csv file is composed of 7 columns and 100 rows, here is an example of what trio.csv looks like:
dput(head(input))
structure(list(familyID = c(1001L, 1004L), Pat1 = structure(2:1, .Label = 
c("REF", "X1"), class = "factor"), Pat2 = structure(1:2, .Label = c("C2", 
"REF"), class = "factor"), Mat1 = structure(1:2, .Label = c("C2", 
"REF"), class = "factor"), Mat2 = structure(c(1L, 1L), .Label = "C2", 
class  = "factor"), 
Ch1 = structure(2:1, .Label = c("REF", "X1"), class = "factor"), 
Ch2 = structure(1:2, .Label = c("C2", "REF"), class = "factor")), 
row.names = 1:2, class = "data.frame") 
How can I save the results from the first and the second loops in two different columns in a new file ?
