remove [] from lines and (na) -> NA for R parsing