Error in crossprod(X, Y) : "crossprod" is not a BUILTIN function

Hi, everyone! I'm working with an abundance species matrix. I'm trying to make a NMDs, but I get this error: "Error in crossprod(X, Y) : "crossprod" is not a BUILTIN function". I'm a beginner in R and I don't know how to fix it.

> str(comp)
'data.frame':	412 obs. of  57 variables:
 $ Alymin : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Allsph : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Ancund : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Andint : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Andrag : int  0 0 0 0 3 0 0 0 0 0 ...
 $ Anhbel : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Armare : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Arnmin : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Bufsp  : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Camlus : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Carhir : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Cenalb : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Cencal : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Cerumb : int  0 0 0 0 0 0 0 0 0 2 ...
 $ Cerbra : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Cortel : int  0 0 0 4 0 0 40 0 0 0 ...
 $ Corcan : int  213 66 34 81 36 21 57 16 5 24 ...
 $ Cruang : int  0 0 0 1 0 1 2 2 7 0 ...
 $ Erocic : int  4 4 4 4 5 1 9 6 1 7 ...
 $ Helvio : int  0 0 0 0 0 0 2 0 0 0 ...
 $ Helsto : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Herhir : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Hishis : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Hypgla : int  0 0 0 1 0 0 0 0 0 0 ...
 $ Jascri : int  0 0 0 0 1 8 0 1 0 2 ...
 $ Jasmon : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Latang : int  0 0 0 0 0 0 0 0 0 0 ...
 $ leotar : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Leupul : int  0 0 0 0 1 0 1 3 6 4 ...
 $ Linspa : int  0 0 0 0 0 0 0 0 0 42 ...
 $ Logmin : int  3 0 0 0 0 0 10 0 0 18 ...
 $ Lupang : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Maltri : int  0 0 0 0 1 0 1 0 0 4 ...
 $ Mibmin : int  0 0 0 6 0 0 12 0 5 0 ...
 $ Micten : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Orncom : int  0 0 0 0 1 0 0 0 0 0 ...
 $ Ornper : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Ornpin : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Pishis : int  0 0 0 0 0 3 0 0 0 0 ...
 $ Rangra : int  0 0 0 0 0 2 0 2 0 0 ...
 $ Rumacet: int  0 0 0 0 0 0 0 0 0 0 ...
 $ Rumace : int  0 0 3 0 1 3 0 6 1 14 ...
 $ Saxgra : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Sedamp : int  2 0 0 5 0 2 0 2 8 0 ...
 $ Sengal : int  0 0 0 0 0 0 0 0 0 1 ...
 $ Sespur : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Silpor : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Silcol : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Silcon : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Spepur : int  0 0 0 2 0 1 0 0 0 1 ...
 $ Stilag : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Teenud : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Triarv : int  2 0 0 0 0 0 0 4 0 2 ...
 $ Tubgut : int  0 0 0 0 4 75 0 8 0 0 ...
 $ Valcar : int  0 0 0 0 0 0 0 0 0 0 ...
 $ Verarv : int  0 0 0 0 0 0 0 0 0 5 ...
 $ Vulbro : int  20 26 0 11 1 0 0 0 0 0 ...

> comp_numeric <- as.data.frame(lapply(comp, as.numeric))

> ord.nmds<-metaMDS(comp_numeric, distance="bray", k=2, trymax=50)
Square root transformation
Wisconsin double standardization
Run 0 stress 0.2921907 
Run 1 stress 0.294355 
Run 2 stress 0.2911298 
Error in crossprod(X, Y) : "crossprod" is not a BUILTIN function

Try updating vegan to the latest version. Apparently a recent change to R moved crossprod into base R, and that seems to be causing older versions of a variety of libraries to spit up the error you are getting.

Thanks for your answer! But I've already update vegan. My Rstudio version is also de last. I restarted both of my computer and R studio and I still have this problem.

If you can reproduce the error on a fairly small example and then paste the result of applying the dput() function to the date into a post here, I can try it at my end and see if I also get the error. In case you're not familiar with dput(), here's the result of applying it to the first five rows of the mtcars data frame. Using dput() makes it easy to turn the result back into a data frame.

dput(mtcars[1:5,])
#> structure(list(mpg = c(21, 21, 22.8, 21.4, 18.7), cyl = c(6, 
#> 6, 4, 6, 8), disp = c(160, 160, 108, 258, 360), hp = c(110, 110, 
#> 93, 110, 175), drat = c(3.9, 3.9, 3.85, 3.08, 3.15), wt = c(2.62, 
#> 2.875, 2.32, 3.215, 3.44), qsec = c(16.46, 17.02, 18.61, 19.44, 
#> 17.02), vs = c(0, 0, 1, 1, 0), am = c(1, 1, 1, 0, 0), gear = c(4, 
#> 4, 4, 3, 3), carb = c(4, 4, 1, 1, 2)), row.names = c("Mazda RX4", 
#> "Mazda RX4 Wag", "Datsun 710", "Hornet 4 Drive", "Hornet Sportabout"
#> ), class = "data.frame")

Created on 2025-06-15 with reprex v2.1.1