[R] From NUM to INT

André Luis Neves andrluis at ualberta.ca
Tue Apr 26 23:25:28 CEST 2016


Ok. I`m trying to run a Poisson glmm with an observation-level random
intercept. But I`m getting the following error for the 'Baci' variable:

'Error: (maxstephalfit) PIRLS step-halvings failed to reduce deviance in
pwrssUpdate'. I  guess this message is because the baci variable is not a
an integer, and cannot be transformed into an integer as R has a threshold
of
2x10^9 even in 64 bit R.

It runs fine for the fungii variable.

If you guys want to run the data (attached), the full command is below.

Thanks.

---------------------------------------------

##Import data:

qPCR <- read.delim(file.choose(),
                 header = TRUE,
                 dec = ".")

##Load package

library(lme4)

##Other steps:

qPCR$obs <- 1:nrow(qPCR)
qPCR$fID<-as.factor(qPCR$ID)
qPCR$fDiet<-as.factor(qPCR$Diet)

##Run the model:

M1 <- glmer (Baci ~ fDiet + Crossover + (1|fID:Crossover) + (1|obs),
             family = poisson, data=qPCR)



Andre



On Tue, Apr 26, 2016 at 2:36 PM, jim holtman <jholtman at gmail.com> wrote:

> Can you explain why you need them as 'integer',  A floating point
> representation can hold a value upto ~4.5e15 as an "integer" keeping the
> precision that you might need.
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Tue, Apr 26, 2016 at 1:11 PM, 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.
>>
>
>


-- 
Andre
-------------- next part --------------
ID	Crossover	Period	Diet	Pen	Time	Baci	Fungii	fNDF	Starch
126BLK	1	1	Forage	1	End1	2.90E+12	43645	3.87056104	1.443771827
13ZBLK	1	1	Forage	1	End1	5.55E+11	19009	3.970286296	1.480970702
157BLK	1	1	Forage	1	End1	9.46E+11	15998	4.114130366	1.534626493
162ZRED	1	1	Forage	1	End1	8.13E+11	2189	3.600760128	1.343132423
17ZBLKY	1	1	Forage	1	End1	4.06E+11	8972	3.79087129	1.414046468
184ZBLK	1	1	Forage	1	End1	5.75E+11	8240	3.815881751	1.42337571
1ZBLKW	1	1	Forage	1	End1	34490836164	3133	3.295433507	1.229241447
2094ZBLK	1	1	Forage	1	End1	3.49E+11	17922	3.737865394	1.394274549
20LZBLK	1	1	Forage	1	End1	1.63E+11	6156	4.007824601	1.494972999
29ZBLK	1	1	Forage	1	End1	3.37E+11	13746	3.59031272	1.339235398
2ZBLKG	1	1	Forage	1	End1	3.13E+11	4003	3.964994752	1.478996884
60ZRED	1	1	Forage	1	End1	3.76E+11	12473	3.477652579	1.297211636
77BLK	1	1	Forage	1	End1	2.92E+11	13328	4.546906317	1.696057799
8ZBLK	1	1	Forage	1	End1	2.45E+11	2900	4.447927304	1.659137284
91ZRED	1	1	Forage	1	End1	5.62E+11	8584	4.118042491	1.536085769
112BLKW	2	1	Forage	2	End1	70249927920	192654	4.024558544	1.501214987
1226BLK	2	1	Forage	2	End1	18390770816	65524	3.933087193	1.467094931
12ZBLK	2	1	Forage	2	End1	64465242768	286966	3.678844325	1.372258889
134BLK	2	1	Forage	2	End1	9652868358	47474	3.902242465	1.455589429
160ZRED	2	1	Forage	2	End1	59600548800	155040	3.853736644	1.437496099
166ZRED	2	1	Forage	2	End1	81366127920	26056	4.037719564	1.506124226
17ZBLK G	2	1	Forage	2	End1	1.88E+11	74214	3.498366487	1.304938205
226ZBLK	2	1	Forage	2	End1	38794514336	291862	3.406420254	1.270641011
3ZBLK	2	1	Forage	2	End1	23837817696	46015	3.865246883	1.441789574
58BLK	2	1	Forage	2	End1	53734722624	50342	4.190382875	1.563069714
60ZBLK	2	1	Forage	2	End1	42301298024	146473	3.628258067	1.353389528
72ZRED	2	1	Forage	2	End1	95837208152	73205	4.123718464	1.538202984
7ZBLK	2	1	Forage	2	End1	47824296528	17068	4.028244534	1.502589911
95BLK	2	1	Forage	2	End1	41780037212	71368	4.099205498	1.529059315
9PZRED	2	1	Forage	2	End1	71202504840	178204	3.380912297	1.261126197
107ZRED	3	1	Grain	3	End1	1.18E+11	7074	2.146324344	3.007347766
129BLK	3	1	Grain	3	End1	10054798609	565	2.372894545	3.324809285
150ZRED	3	1	Grain	3	End1	1.48E+11	7869	2.152246315	3.015645405
168BLK	3	1	Grain	3	End1	94464253180	5281	2.500082872	3.503020716
174ZBLK	3	1	Grain	3	End1	62911040256	24635	2.273695448	3.185815296
185ZRED	3	1	Grain	3	End1	78074111590	1973	1.894214123	2.654100545
2ZBLKY	3	1	Grain	3	End1	4929843844	3183	2.483620769	3.479954645
4089ZBLK	3	1	Grain	3	End1	19370087262	1329	2.213050085	3.100841327
438XZRED	3	1	Grain	3	End1	7196105124	630	2.217241768	3.106714553
4ZBLK	3	1	Grain	3	End1	52954599928	1469	2.217302693	3.10679992
706ZBLK	3	1	Grain	3	End1	31205271204	2407	2.15080847	3.013630752
86BLK	3	1	Grain	3	End1	93866942272	417	2.753545642	3.858163077
86ZRED	3	1	Grain	3	End1	57127597772	7834	2.295665227	3.216598513
89BLK	3	1	Grain	3	End1	37992593088	6314	2.476126918	3.469454547
112XZBLKG	4	1	Grain	4	End1	9.56E+11	5205	1.890716993	2.649200499
1191ZBLK	4	1	Grain	4	End1	4.59E+11	35115	2.043372229	2.863095191
122ZRED	4	1	Grain	4	End1	2.93E+11	930	2.1174456	2.966883971
14ZBLK	4	1	Grain	4	End1	8.03E+11	5570	2.268248698	3.178183517
15ZBLK	4	1	Grain	4	End1	3.99E+11	1716	2.22233515	3.113851206
163BLK	4	1	Grain	4	End1	7.18E+11	20475	2.524745564	3.537577138
175ZRED	4	1	Grain	4	End1	2.08E+11	4421	2.113107696	2.960805865
1ZBLKY	4	1	Grain	4	End1	6.84E+11	43059	2.593311258	3.633648772
20SXZBLK	4	1	Grain	4	End1	3.16E+11	20297	1.878154129	2.631597894
22ZBLK	4	1	Grain	4	End1	7.70E+11	154975	2.263447759	3.171456625
63ZBLK	4	1	Grain	4	End1	2.10E+11	13317	2.444859889	3.425644379
6ZBLK	4	1	Grain	4	End1	1.31E+11	1395	2.630183444	3.685312672
82ZBLK	4	1	Grain	4	End1	1.10E+12	5368	2.102445712	2.945866701
92ZBLK	4	1	Grain	4	End1	4.32E+11	14981	2.137551055	2.995054968
94BLK	4	1	Grain	4	End1	1.54E+11	1680	2.533433557	3.549750423
126BLK	1	2	Forage	1	End2	2.22E+11	13000	4.760093885	1.775579657
13ZBLK	1	2	Forage	1	End2	6.75E+11	18291	4.585536093	1.71046723
157BLK	1	2	Forage	1	End2	2.88E+11	8904	5.286298418	1.971861094
162ZRED	1	2	Forage	1	End2	1.85E+11	3124	4.501846838	1.679250002
17ZBLKY	1	2	Forage	1	End2	1.02E+11	4288	4.722218572	1.761451651
184ZBLK	1	2	Forage	1	End2	4.28E+11	18173	4.787683496	1.785870957
1ZBLKW	1	2	Forage	1	End2	1.26E+11	3974	4.120447496	1.536982868
2094ZBLK	1	2	Forage	1	End2	2.80E+11	22940	5.320906238	1.98477028
20LZBLK	1	2	Forage	1	End2	3.00E+11	1865	4.910904822	1.831834185
29ZBLK	1	2	Forage	1	End2	2.75E+11	6551	4.64713525	1.733444553
2ZBLKG	1	2	Forage	1	End2	4.53E+11	12748	5.216415474	1.945793806
60ZRED	1	2	Forage	1	End2	2.45E+11	15630	4.320339869	1.611545438
77BLK	1	2	Forage	1	End2	1.44E+11	4192	4.946939294	1.845275532
8ZBLK	1	2	Forage	1	End2	66556874137	3308	5.369136284	2.002760742
91ZRED	1	2	Forage	1	End2	35178277612	861	5.194279355	1.937536734
112BLKW	2	2	Grain	2	End2	22345514304	35522	2.189470508	3.067802525
1226 BLK	2	2	Grain	2	End2	23881492608	48447	2.61032416	3.657486601
12ZBLK	2	2	Grain	2	End2	9521876928	21520	2.66964942	3.740610891
134BLK	2	2	Grain	2	End2	17265347752	62156	3.266154115	4.576410507
160ZRED	2	2	Grain	2	End2	1.06E+11	201494	2.801511562	3.925371093
166ZRED	2	2	Grain	2	End2	29245020768	9813	2.633190427	3.689525942
17ZBLKG	2	2	Grain	2	End2	28686200320	151168	2.684194907	3.760991472
226ZBLK	2	2	Grain	2	End2	35823496868	203516	2.656602944	3.722330667
3ZBLK	2	2	Grain	2	End2	19774776776	5962	3.01716587	4.22753768
58BLK	2	2	Grain	2	End2	6712885842	10103	2.776815993	3.890768604
60ZBLK	2	2	Grain	2	End2	41185544916	96469	2.757875102	3.86422935
7ZBLK	2	2	Grain	2	End2	7965902400	79680	2.876690768	4.030709327
95BLK	2	2	Grain	2	End2	29843174520	33088	3.319343593	4.650937575
9PZRED	2	2	Grain	2	End2	82361326080	274104	2.695285046	3.776530553
107ZRED	3	2	Forage	3	End2	1.59E+11	170772	4.574352981	1.706295778
129BLK	3	2	Forage	3	End2	7594466101	1081	5.509799583	2.055230063
150ZRED	3	2	Forage	3	End2	56872492896	33383	4.602932045	1.716956157
168BLK	3	2	Forage	3	End2	64542557920	5990	5.156588126	1.923477393
174ZBLK	3	2	Forage	3	End2	20398760236	601	4.777512847	1.782077167
185ZRED	3	2	Forage	3	End2	1.01E+11	12468	4.531116217	1.690167878
2ZBLKY	3	2	Forage	3	End2	1.74E+11	1757	5.336898548	1.990735629
4089ZBLK	3	2	Forage	3	End2	1.88E+11	2227	4.617405661	1.722355012
438XZRED	3	2	Forage	3	End2	3.83E+11	17545	4.698264622	1.752516503
4ZBLK	3	2	Forage	3	End2	3.96E+11	7375	4.899836763	1.827705648
706ZBLK	3	2	Forage	3	End2	3.35E+11	45618	4.437969639	1.655422939
86ZRED	3	2	Forage	3	End2	3.58E+11	3410	4.810601973	1.79441986
89BLK	3	2	Forage	3	End2	3.51E+11	22147	4.768193587	1.778600956
112XZBLKG	4	2	Grain	4	End2	2.68E+11	49973	2.531626089	3.547217868
1191ZBLK	4	2	Grain	4	End2	2.64E+11	6067	2.63885618	3.697464579
122ZRED	4	2	Grain	4	End2	8.69E+11	11653	2.389283575	3.347772968
14ZBLK	4	2	Grain	4	End2	9.29E+11	50505	2.780220526	3.895538906
15ZBLK	4	2	Grain	4	End2	9.35E+11	11492	2.662929278	3.731194885
163BLK	4	2	Grain	4	End2	5.01E+11	12751	2.616739418	3.666475416
175ZRED	4	2	Grain	4	End2	1.19E+12	14100	2.539769021	3.558627433
20SXZBLK	4	2	Grain	4	End2	5.57E+11	22956	2.310979313	3.238056024
22ZBLK	4	2	Grain	4	End2	2.60E+11	23005	2.772700065	3.885001523
63ZBLK	4	2	Grain	4	End2	2.98E+11	3578	2.921279989	4.093186042
6ZBLK	4	2	Grain	4	End2	4.77E+11	11550	2.511694326	3.519290242
82ZBLK	4	2	Grain	4	End2	2.55E+11	3153	2.781770351	3.897710461
92ZBLK	4	2	Grain	4	End2	1.95E+11	48511	2.666117852	3.735662593
94BLK	4	2	Grain	4	End2	1.02E+12	104139	2.966186797	4.156107749


More information about the R-help mailing list