Joris Meys
2010-Jul-28 11:16 UTC
[R] strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
Dear all, I run a gamm with following call : result <- try(gamm(values~ s( VM )+s( RH )+s( TT )+s( PP )+RF+weekend+s(day)+s(julday) ,correlation=corCAR1(form=~ day|month ),data=tmp) )" with mgcv version 1.6.2 No stress about the data, the error is not data-related. I get : Error in isS4(x) : object 'VM' not found What so? I did define the dataframe to be used, and the dataframe contains a variable VM :> str(tmp)'data.frame': 4014 obs. of 12 variables: $ values : num 73.45 105.45 74.45 41.45 -4.55 ... $ dates :Class 'Date' num [1:4014] 9862 9863 9864 9865 9866 ... $ year : num -5.65 -5.65 -5.65 -5.65 -5.65 ... $ day : num -178 -177 -176 -175 -174 ... $ month : Factor w/ 156 levels "1996-April","1996-August",..: 17 17 17 17 17 17 17 17 17 17 ... $ julday : num -2241 -2240 -2239 -2238 -2237 ... $ weekend: num -0.289 -0.289 -0.289 0.711 0.711 ... $ VM : num 0.139 -1.451 0.349 0.839 -0.611 ... $ RH : num 55.2 61.4 59.8 64.1 60.7 ... $ TT : num -23.4 -23.6 -19.5 -16.1 -15.3 ... $ PP : num 6.17 4.27 -4.93 -9.23 -2.63 ... $ RF : Ord.factor w/ 3 levels "None"<"<2.5mm"<..: 1 1 1 1 1 1 1 1 1 1 ... - attr(*, "means")= num Any idea what I'm missing here? Cheers Joris -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
Joris Meys
2010-Jul-28 12:27 UTC
[R] strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
Dear all, it gets even more weird. After restarting R, the code I used works just fine. The call is generated in a function that I debugged using browser(). Problem is solved, but I have no clue whatsoever how that error came about. It must have something to do with namespaces, but the origin is dark. I tried to regenerate the error, but didn't succeed. Somebody an idea as to where I have to look for a cause? Cheers Joris On Wed, Jul 28, 2010 at 1:16 PM, Joris Meys <jorismeys at gmail.com> wrote:> Dear all, > > I run a gamm with following call : > > result <- try(gamm(values~ s( VM )+s( RH )+s( TT )+s( PP > )+RF+weekend+s(day)+s(julday) ,correlation=corCAR1(form=~ day|month > ),data=tmp) )" > > with mgcv version 1.6.2 > > No stress about the data, the error is not data-related. I get : > > Error in isS4(x) : object 'VM' not found > > What so? I did define the dataframe to be used, and the dataframe > contains a variable VM : > >> str(tmp) > 'data.frame': ? 4014 obs. of ?12 variables: > ?$ values : num ?73.45 105.45 74.45 41.45 -4.55 ... > ?$ dates ?:Class 'Date' ?num [1:4014] 9862 9863 9864 9865 9866 ... > ?$ year ? : num ?-5.65 -5.65 -5.65 -5.65 -5.65 ... > ?$ day ? ?: num ?-178 -177 -176 -175 -174 ... > ?$ month ?: Factor w/ 156 levels "1996-April","1996-August",..: 17 17 > 17 17 17 17 17 17 17 17 ... > ?$ julday : num ?-2241 -2240 -2239 -2238 -2237 ... > ?$ weekend: num ?-0.289 -0.289 -0.289 0.711 0.711 ... > ?$ VM ? ? : num ?0.139 -1.451 0.349 0.839 -0.611 ... > ?$ RH ? ? : num ?55.2 61.4 59.8 64.1 60.7 ... > ?$ TT ? ? : num ?-23.4 -23.6 -19.5 -16.1 -15.3 ... > ?$ PP ? ? : num ?6.17 4.27 -4.93 -9.23 -2.63 ... > ?$ RF ? ? : Ord.factor w/ 3 levels "None"<"<2.5mm"<..: 1 1 1 1 1 1 1 1 1 1 ... > ?- attr(*, "means")= num > > Any idea what I'm missing here? > > Cheers > Joris > > > -- > Joris Meys > Statistical consultant > > Ghent University > Faculty of Bioscience Engineering > Department of Applied mathematics, biometrics and process control > > tel : +32 9 264 59 87 > Joris.Meys at Ugent.be > ------------------------------- > Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php >-- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 Joris.Meys at Ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
Possibly Parallel Threads
- identical() fails to compare isS4(<S4 instance>) to TRUE
- Reference Classes: shortcut like 'isS4' for Ref Classes?
- Deviance explined in GAMM, library mgcv
- fitting gamm with interaction term
- mgcv::gamm error when combining random smooths and correlation/autoregressive term