stringdist 0.9.5.0: now with C API

June 7, 2018
By

(This article was first published on R – Mark van der Loo, and kindly contributed to R-bloggers)

Version 0.9.5.0 of stringdist is accepted on CRAN (binaries for non-linux OSs will be available in a few days). The main new feature, with a huge thanks to our awesome new contributor Chris Muir, is that we made it easy to call stringdist functionality from your package’s C or C++ code.

The main steps to get it done are:

  1. Make sure to add stringdist to the Imports: and LinkingTo: fields in your DESRIPTION file
  2. Add the #include to your C/C++ source file.
  3. Start using stringdist from C!

Here’s an example source file

#include 
#include 
#include 


SEXP my_soundex(SEXP strings, SEXP useBytes){
  Rprintf("\nWow, using 'stringdist' soundex encoding, from my own C code!\n");
  return sd_soundex(strings, useBytes);
}

Great! how can I learn more?

  • The full API is desribed in a pdf file that is generated from doxygen that comes with the package. You can find it by typing ?stringdist_api on the R command line.
  • A minimal example package that links to stringdist is available on GitHub
  • A more sophisticated package with more elaborate examples can be found here: refinr (By Chris)

Any other news?

A few fixes, and a couple of long-deprecated function arguments have finally been removed. Check out the NEWS file on CRAN for a complete overview.

Happy coding!

To leave a comment for the author, please follow the link and comment on their blog: R – Mark van der Loo.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers

Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)