You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to read a fixed width file I find a problem when a character field has just blanks. It becomes NA instead of its original value. The function parse_character seems to do a trimws of the data and then the resulting "" is considered as NA (by default). I dont know weather this is the intended behavior, but in that case it would be nice if read_fwf had a trim_ws parameter as read_delim has, in order to be able to read such fields.
The text was updated successfully, but these errors were encountered:
In that case I would get an empty , "" , string and not an NA, but the trimming of white space would have been done anyway. My intention was to get the string with as many blanks as there were originally in the file.
Excuse me for the not very clear initial exposition of my post. What I wanted to point out was not about this particular case of empty strings, but the general trimming issue:
Why doesnt read_fwf have a trim_ws parameter as read_delim has? This would affect the cases where the strings are composed of something else than white space as well.
I understand that in many situations in a fixed width format, the blanks are just there because of the format, with no meaning by themselves at all. But there are cases in which I think it would be good to be able to preserve the data exactly as it came, and making the trimming of white space an option would get it.
Thanks for your attention