I'm re-running an RLQ & 4th corner analyses I coded about 6 months ago. However, an error is popping up with analysis of the Q table. I have been following Stephane Dray's (2013) tutorial and used
dudi.pca for the environment table (R, 6 "numeric" variables by 6 sites),
dudi.coa for the species presence table (L, 15 species ("integer" data) by 6 sites), and
dudi.hillsmith for the trait table (Q, 7 mixed traits (5 "character" and 2 "numeric") by 15 species).
The dudi.pca(R), dudi.coa(L) both run fine, but when I try:
> q_feeding <- dudi.hillsmith(traits_feeding, row.w=l_feeding$cw, scannf=F, nf=2)
I get
Error in x * w : non-numeric argument to binary operator
For simplicity of our discussion, "feeding" = "presence", it's a 0/1 as to whether the species was observed feeding at a site. This error also comes up with different data and when L is abundance data. I have tried changing the categorical traits to TRUE/FALSE, to see if "logical" would work. I'm stumped and hope it's something simple that I'm missing.
"row.w=l_feeding$cw" returns a vector of numbers, which tells me that the dudi.coa is working, so I am guessing my error lies within the "traits_feeding" table:
> traits_feeding
by fe dus fnt mo se ete
c.notat 0.450 0.673 Y N N N N
c.riat 0.423 0.667 Y N N Y N
z.op 0.501 0.556 N Y N N N
s.liat 0.335 0.596 N Y Y N N
s.i 0.382 0.549 N Y N N N
n.turat 0.354 0.648 N Y Y N N
c.eeke 0.297 0.348 Y Y N Y Y
c.rdid 0.306 0.688 Y Y N Y Y
s.tipinn 0.320 0.658 Y Y N Y N
s.amele 0.302 0.695 Y Y N Y N
s.midiat 0.285 0.678 Y Y N Y N
s.obb 0.294 0.666 Y Y N Y N
s.r 0.338 0.658 Y Y N Y N
s.vulat 0.315 0.684 Y Y N Y N
s.hlege 0.302 0.670 Y Y N Y N
> class(traits_feeding$by)
[1] "numeric"
> class(traits_feeding$fe)
[1] "numeric"
> class(traits_feeding$dus)
[1] "character"
> class(traits_feeding$fnt)
[1] "character"
> class(traits_feeding$mo)
[1] "character"
> class(traits_feeding$se)
[1] "character"
> class(traits_feeding$ete)
[1] "character"
I'm running R 4.0.0 on RStudio 1.2.5042 and am running the most recent (16-May-2020) of ade4.
Can anyone help me out with this? The most mystifying part is that this ran without error six months ago, I believe exactly as is here...
Thank you, Ryan
I faced the same problem as you and I believe that the problem is due to your R version and not related to the ade4 version. I was able to solve this problem by removing the R 4.0 and later installing the 3.6.2 version. Hope it helps.
Cheers!