保存大量 [英] Preserving large numbers

查看:109
本文介绍了保存大量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试读取第一列中带有条形码的CSV文件,但是当R将其获取到data.frame中时,它将1665535004661转换为1.67E+12.

I am trying to read a CSV file that has barcodes in the first column, but when R gets it into a data.frame, it converts 1665535004661 to 1.67E+12.

有没有办法将这个数字保存为整数格式?我尝试分配一个"double"类,但这没有用,也没有分配一个"character"类.一旦采用1.67E+12格式,任何将其转换回整数的尝试都会返回167000000000.

Is there a way to preserve this number in an integer format? I tried assigning a class of "double", but that didn’t work, nor did assigning a class of "character". Once it is in the 1.67E+12 format any attempt to convert it back to an integer returns 167000000000.

推荐答案

它不是"1.67E + 12格式",只是不会完全使用默认值打印. R正在很好地阅读它,并且所有数字都在这里.

It's not in a "1.67E+12 format", it just won't print entirely using the defaults. R is reading it in just fine and the whole number is there.

x <- 1665535004661
> x
[1] 1.665535e+12
> print(x, digits = 16)
[1] 1665535004661

看,数字一直都在那里.除非您有很多数字,否则它们不会丢失.对您带来的内容进行排序可以很好地工作,您只需使用digits选项显式调用print()即可查看data.frame,而不是通过键入名称来隐式查看.

See, the numbers were there all along. They don't get lost unless you have a really large number of digits. Sorting on what you brought in will work fine and you can just explicitly call print() with the digits option to see your data.frame instead of implicitly by typing the name.

这篇关于保存大量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆