MomX / Momocs

:dove: Morphometrics using R
http://momx.github.io/Momocs/
51 stars 18 forks source link

as_df() mixes up factors #185

Closed QGouil closed 6 years ago

QGouil commented 6 years ago

I made a Coo object with a bunch of factors. imgCoo <- Out(img, fac = data.frame(lat = lat, type = type, line = line)) All is well, I can align and get the EFDs, but if I try to export the coefficients with df <- as_df(img.f) the factors get mixed up: a wild-type sample, correctly labeled as such in imgCoo and img.f, can end up being labelled mutant in df. Something like cbind(img.f$fac, img.f$coe) %>% gather('A1','B1',...,'Dn', key = 'coefficient', value = 'value') should work. Cheers.

vbonhomme commented 6 years ago

thanks. will check that and I'm reviewing everything anyway these days. cheers.

2018-02-01 1:59 GMT+01:00 QGouil notifications@github.com:

I made a Coo object with a bunch of factors. imgCoo <- Out(img, fac = data.frame(lat = lat, type = type, line = line)) All is well, I can align and get the EFDs, but if I try to export the coefficients with df <- as_df(img.f) the factors get mixed up: a wild-type sample, correctly labeled as such in imgCoo and img.f, can end up being labelled mutant in df. Something like cbind(img.f$fac, img.f$coe) %>% gather('A1','B1',...,'Dn', key = 'coefficient', value = 'value') should work. Cheers.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vbonhomme/Momocs/issues/185, or mute the thread https://github.com/notifications/unsubscribe-auth/AEgoFsnolYUU37IJDeIE_W9l6jM5G0Lhks5tQQxXgaJpZM4R05MB .

-- vincentbonhomme.fr http://www.vincentbonhomme.fr

vbonhomme commented 6 years ago

should be fixed now. Thanks for that.