beckyfisher / FSSgam

Code for full subsets model fitting using GA(M)M
16 stars 14 forks source link

Error when factor variables are included #4

Closed dahliasan closed 6 years ago

dahliasan commented 6 years ago

Hi, thanks for your code. I'm trying out this method in my analysis, however an error is coming up when I specify factor variables in full.subsets.gam()

This is the error:

Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list?

Seems to coming out from a sort function

The function runs if I don't specify factors.

dahliasan commented 6 years ago

So I've found out what the problem was... I gave a class tibble type dataframe to full.subsets.gam() which caused the error at line 157 of the full.subsets.gam() function. It worked once I just gave it a pure dataframe.

TimLanglois commented 6 years ago

Thanks Dahlia,

I've also encountered this issue and found the same fix.

Becky – would it be sensible to coerce dat to as.data.frame() in the function?

Cheers Tim

Dr Tim Langlois Lecturer Marine Ecology Grouphttps://uwamegfisheries.github.io/ | The UWA Oceans Institute & School of Biological Sciences

M: 0423 708 312 | E: timothy.langlois@uwa.edu.aumailto:timothy.langlois@uwa.edu.au Phttps://scholar.google.com.au/citations?user=jEiHZ0cAAAAJublicationshttps://scholar.google.com.au/citations?user=jEiHZ0cAAAAJ Facebookhttps://www.facebook.com/marineecologygroupUWA?fref=ts YouTubehttps://www.youtube.com/channel/UCZJl1AUIa-O6WgTSgViNeew GitHubhttps://github.com/TimLanglois applewebdata://2F8F787C-E9AF-47C1-8006-005525C21D26/appear.in/tim.langloisappear.inhttps://appear.in/tim.langlois [http://static.weboffice.uwa.edu.au/visualid/graphics/email/uwa-crest-sig.gif]http://www.uwa.edu.au/

From: Dahlia Foo notifications@github.com<mailto:notifications@github.com> Reply-To: beckyfisher/FSSgam reply@reply.github.com<mailto:reply@reply.github.com> Date: 2018AugustThursday, 2 at 20:09 To: beckyfisher/FSSgam FSSgam@noreply.github.com<mailto:FSSgam@noreply.github.com> Cc: Subscribed subscribed@noreply.github.com<mailto:subscribed@noreply.github.com> Subject: Re: [beckyfisher/FSSgam] Error when factor variables are included (#4)

So I've found out what the problem was... I gave a class tibble type dataframe to full.subsets.gam() which caused the error at line 157 of the full.subsets.gam() function. It worked once I just gave it a pure dataframe.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/beckyfisher/FSSgam/issues/4#issuecomment-409904195, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AOSO6pzymS1e2f4_-flWna2T9VEkMxTbks5uMuvhgaJpZM4Vrwxk.