I have been running the mnnCorrect from the SCRAN package without issues, and now wanted to run the fastMNN (scripts downloaded form github; https://github.com/MarioniLab/scran/tree/master/R). However, when calling the fastMNN function ( mnn.out <- do.call(fastMNN, c(original, list(k=20, d=50))) ) I end up getting the error:

Fejl i FUN(X[[i]], ...) : objekt 'cxx_cosine_norm' blev ikke fundet

I can see that "cxx_cosine_norm" is called within the cosineNorm function (out <- .Call(cxx_cosine_norm, X, mode!="l2norm")), which is called within the fastMNN function. I am puzzled as the mnnCorrect calls the same cosineNorm function, without any issues. Does anybody how an suggestion to why the "cxx_cosine_norm" can't be found when called through fastMNN?

I imagine that you're sourceing the fastMNN.R file and trying to run the function. Unfortunately, packages don't work that way. The cxx_cosine_norm object provides a registered entry point to the C++ shared library within scran, which is only visible to other scran functions in the installed package (i.e., following R CMD INSTALL or friends). It's not exported, nor should it be - why would a user ever need to deal with C++ code? You'll face similar issues with several internal R functions that are used by fastMNN but are not exported.