Just use data.frame
after na.omit
or you can do it directly:
> temp <- data.frame(a=c(1,NA,44),b=c(99,29,NA)) > new <- na.omit(temp) > attributes(new) $names [1] "a" "b" $row.names [1] 1 $class [1] "data.frame" $na.action 2 3 2 3 attr(,"class") [1] "omit" > reduced <- data.frame(new) > attributes(reduced) $names [1] "a" "b" $row.names [1] 1 $class [1] "data.frame" >
direct method:
attributes(new)$na.action <- NULL
Xu wang
source share