big integers when reading file with readr in r

梦想的初衷 提交于 2019-12-11 00:01:48

问题


I wanted to use the readr package since I will work on some bigger files in the future. My problem is, that there is a column called Intensity which has some very big values (e.g. 5493500000). My problem is, the first time this big value appears is in line 2200 and readr already defined the column as integer instead of numeric and produces a buffer overflow.

Is there a way to only provide a single column type to the read_tsv function, since I don't want to provide all (about) 40 columns the correct type.

Any help os appreciated.


回答1:


You need the argument col_types = cols(Intensity = col_double()), as per the manual, this will prevent imputation of the column type based on the first 1000 rows. If you only want a subset of the columns use cols_only.



来源:https://stackoverflow.com/questions/38894729/big-integers-when-reading-file-with-readr-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!