3 ms·
So if I have Zip codes with leading 0’s, use R?
by user3939382 5y ago
So if I have Zip codes with leading 0’s, use R?
- jasode 5y ago>So if I have Zip codes with leading 0’s, use R? Several other software tools also mess up leading 0s including R if used in a naive way without specifying extra options. My previous comment about this: https://news.ycombinator.com/item?id=25017116 https://news.ycombinator.com/item?id=25017116 Like R, MS Excel can also preserve leading 0s -- if you specify the option on import. (Click on Excel 2019 Data tab and import via "From Text/CSV" button on the ribbon menu and a dialog pops up that provides option "Do not detect data types" (Earlier version of Excel has different verbiage to interpret numbers as text))
- user3939382 5y agoThe problem that I've had with this issue and Excel is that Excel performs overly-clever-automagic type conversions in certain situations where you don't want them. And then especially when you're collaborating on files with non-technical normal office workers, they're not expecting this behavior. So the end result has been that this issue has bitten me many times, despite knowing how to ideally tell Excel to handle it.
- shawnz 5y agoIf you have zip codes, don't store those in a numeric type (doesn't matter if it's Excel, R, or any other system) Zip codes aren't numbers, they are strings that happen to contain only numeric characters
- TeMPOraL 5y agoWAIT. All these words on SO and here have been written because people don't know to change the column type from "General" to "Text"?
- Linosaurus 5y agoThey would like to be able to just open a csv file in excel without going through a file import wizard. Changing the column type after the fact is too late.
- intended 5y agoIf you get to the point that you are using r and python, it should be because you are doing working with larger data sets, or it’s specifically sophisticated. If you can learn a language, you could constrain type conversions easily once you have for knowledge. Its not like there aren’t painful gotchas in other tools- it’s an issue if you aren’t aware of them and if they impact your work. If it’s big, unusually complex, you probably want a DB before analysis. If it’s repetitive, or advanced modeling/ml: python/r
- deleted 5y ago[deleted]