Make sure Rcpp is installed. (e.g > install.packages("Rcpp")) - go into rstudio - set your working directory, your R project with Rcpp will be a subdirectory. - /file/New Project/New Directory/Create R Package using Rcpp - you will have to choose a name for the R package subdirectory. You will see this: * Edit the help file skeletons in 'man', possibly combining help files for multiple functions. * Edit the exports in 'NAMESPACE', and add necessary imports. * Put any C/C++/Fortran code in 'src'. * If you have compiled code, add a useDynLib() directive to 'NAMESPACE'. * Run R CMD build to build the package tarball. * Run R CMD check to check the package tarball. Read "Writing R Extensions" for more information. - you should also edit the DESCRIPTION file - there is already a "dummy" C++ file in src, try building the package as is using (i) /build/install package (main menu) or (ii) build/clean and install (build tab in top-right panel). - try calling the function rcpp_hello_world() - in the Files tab (lower right panel) do /wheel/show hidden file so you can see the .o and .so files. - copy cmll.{h,cpp} to src - rebuild, notice that cmll.o is in src - start R script in directory above project to test - e.g. call rcpp_hello_world - edit DESCRIPTION file in main project directory - start new C++ file at + - note in Rcpp file: // Learn more about Rcpp at: // http://www.rcpp.org/ // http://adv-r.had.co.nz/Rcpp.html // http://gallery.rcpp.org/ - edit C++: - get rid of comments, #include "cmll.h", change name -> rcmll - add NumericVector args for x,y,b=(b0,b1) - call c - return list