[R] From NUM to INT

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Apr 26 19:56:57 CEST 2016


That is the "impossible" case, since R integers are 32 bit signed (~2×10^9) even in 64 bit R. You can Google for "R arbitrary precision" and look for packages like Ryacas, bit64 or gmp. However, having such large integers stored as integers would not be necessary for most statistical analyses so you should confirm that your analysis cannot be performed using floating point numbers before resorting to that.
-- 
Sent from my phone. Please excuse my brevity.

On April 26, 2016 10:11:38 AM PDT, "André Luis Neves" <andrluis at ualberta.ca> wrote:
>Dear all:
>
>I converted the columns (Baci, Meti, Fungii, Protozoai) into integers
>(using excel) and then imported the data (.txt) into R. Interestingly,
>the
>other three variables were loaded as INT, but the 'Baci' one continued
>as
>Num.
>
>I imported the data using the following command line:
>
>X <- read.delim(file.choose(),
>                 header = TRUE,
>                 dec = ".")
>
>Here is the structure of X:
>
>> str(X)
>'data.frame': 115 obs. of  5 variables:
>$ ID       : Factor w/ 61 levels "107ZRED","112BLKW",..: 8 12 15 18 26
>27
>29 31 32 36 ...
> $ Baci     : num  2.90e+12 5.55e+11 9.46e+11 8.13e+11 4.06e+11 ...
> $ Meti     : int  352645997 334146268 767208656 171567266 462747405
>414905627 237010514 387480048 214671355 328813226 ...
>$ Fungii   : int  43645 19009 15998 2189 8972 8240 3133 17922 6156
>13746
>...
>$ Protozoai: int  3220523 1851891 3252462 1665675 34123768 23175015
>203685
>4261780 43110492 69802572 ...
>
>
>I need Baci as an integer, and tried to convert it using as.integer
>function, but was not successful.
>
>
>Could anyone please help me to solve this problem.
>
>Thanks,
>
>
>>-- 
>Andre
>
>
>------------------------------------------------------------------------
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list