I am trying to remove all NA values from two columns in a matrix and make sure that neither column has a value that the other doesn't. 
code:
data <- dget(file)
dependent <- data[,"chroma"]
independent <- data[,"mass..Pantheria."]
names(independent) <- names(dependent) <- rownames(data)
for (name in rownames(data)) {
    if(is.na(dependent[name])) {
      independent$name <- NULL
      dependent$name <- NULL
  }
    if(is.na(independent[name])) {
      independent$name <- NULL
      dependent$name <- NULL
  }
}
print(dput(independent))
print(dput(dependent))
I am brand new to R and am trying to perform this task with a for loop. However, when I delete a section by assigning NULL I receive the following warning: 
1: In independent$Aeretes_melanopterus <- NULL : Coercing LHS to a list
2: In dependent$name <- NULL : Coercing LHS to a list
No elements are deleted and independent and dependent retain all their original rows.
file (input):
structure(list(chroma = c(7.443501276, 10.96156313, 13.2987235, 
17.58110922, 13.4991105), mass..Pantheria. = c(NA, 126.57, NA, 
160.42, 250.57)), .Names = c("chroma", "mass..Pantheria."), class = "data.frame", row.names = c("Aeretes_melanopterus", 
"Ammospermophilus_harrisii", "Ammospermophilus_insularis", "Ammospermophilus_nelsoni", 
"Atlantoxerus_getulus"))
                              chroma mass..Pantheria.
Aeretes_melanopterus        7.443501               NA
Ammospermophilus_harrisii  10.961563           126.57
Ammospermophilus_insularis 13.298723               NA
Ammospermophilus_nelsoni   17.581109           160.42
Atlantoxerus_getulus       13.499111           250.57
desired output:
structure(list(chroma = c(10.96156313, 17.58110922, 13.4991105
), mass..Pantheria. = c(126.57, 160.42, 250.57)), .Names = c("chroma", 
"mass..Pantheria."), class = "data.frame", row.names = c("Ammospermophilus_harrisii", 
"Ammospermophilus_nelsoni", "Atlantoxerus_getulus"))
                            chroma mass..Pantheria.
Ammospermophilus_harrisii 10.96156           126.57
Ammospermophilus_nelsoni  17.58111           160.42
Atlantoxerus_getulus      13.49911           250.57
structure(c(126.57, 160.42, 250.57), .Names = c("Ammospermophilus_harrisii", 
"Ammospermophilus_nelsoni", "Atlantoxerus_getulus"))
Ammospermophilus_harrisii  Ammospermophilus_nelsoni      Atlantoxerus_getulus 
                   126.57                    160.42                    250.57 
structure(c(10.96156313, 17.58110922, 13.4991105), .Names = c("Ammospermophilus_harrisii", 
"Ammospermophilus_nelsoni", "Atlantoxerus_getulus"))
Ammospermophilus_harrisii  Ammospermophilus_nelsoni      Atlantoxerus_getulus 
                 10.96156                  17.58111                  13.49911 
 
    