Removed chars that R doesn't seem to like
Moved undef cell handling to common sanitizing
Handled undef headers different from undef data
Made sure all R-problem chars are purged
Indented the loop contents