R: reading in .csv file removes leading zeros -
i realize reading .csv file removes leading zeros, of files, maintains leading zeros without having explicitly set colclasses in read.csv. on other hand, what's confusing me in other cases, remove leading zeros. question is: in cases read.csv remove leading zeros?
the read.csv
, read.table
, , related functions read in character strings, depending on arguments function (specifically colclasses
, others) , options function try "simplify" columns. if enough of column looks numeric , have not told function otherwise, convert numeric column, drop leading 0's (and trailing 0's after decimal). if there in column not number not convert numeric , either keep character or convert factor, keeps leading 0's. function not @ entire column make decision, may obvious not being numeric may still converted.
the safest approach (and quickest) specify colclasses
r not need guess (and not need guess r going guess).
Comments
Post a Comment