TL; DR:
You have to translate, seeing what one code does and implementing in the other language.
More details:
In fact, your question is not very clear, but assuming you need to translate the function you put up for r , there is not much to do. Maybe there is someone who has something similar in R, but you still need to describe what the function does (it's the fit error of a function sigmoid ).
There is an R / MATLAB CRAN package , but it is just an interface to MatLab, which needs to be installed on the system . I do not know if it is compatible with RStudio.