Blog Archives

Open iTerm (OS X) to a Directory from R

August 20, 2014
By

Sometimes you need to get to a command prompt from R, whether it’s to wrangle git on the command line or do some package work. RStudio provides ways to do this from menus and hotkeys, but on OS X it sticks you in Terminal.app. I’m an iTerm user—and, I really prefer being in that app vs the one...

Read more »

Update to resolv (0.1.2) + valgrind and R + Parallel DNS Requests with Revolution R’s ‘foreach’ and `doParallel`

August 15, 2014
By

Thanks to a blog comment by @arj, I finally ran at least one of the new Rcpp-based through valgrind (resolv) and, sure enough there were a few memory leaks which are now fixed. However, I first ran valgind with a simple test R script that just did library(stats) to get a baseline (and dust off some...

Read more »

New and Updated R Packages for Security Data Science

August 12, 2014
By

We’ve got some new and updated R packages that are (hopefully) helpful to security folks who are endeavouring to use R in their quest to find and prevent malicious activity. All packages now incorporate a testthat workflow and are fully roxygen-ized and present some best practices in R package development (a post on that very topic is pending). We’ll start with...

Read more »

Basic Forward and Reverse DNS Lookups In R (with Rcpp)

August 4, 2014
By

Back in April, we showed you how to use a C resolver library to make many different kinds of DNS lookups. More oft than not, such complete functionality is not necessary, but R still only provides nsl to get an IPv4 address of a given hostname, which is woefully inadequate. I needed to write an R implementation...

Read more »

Controlling RStudio Python Child Processes

June 23, 2014
By

I’ve been using RStudio’s new ability to run Python scripts since I often need to analyze/process data in R but then run web services with said data in Python (usually via Flask). I’d rather live with the foibles of the RStudio editor than use a separate one and run code on the command line. Everyting below is for OS...

Read more »

Can You Track Me Now? (Visualizing Xfinity Wi-Fi Hotspot Coverage) [Part 2]

June 13, 2014
By
Can You Track Me Now? (Visualizing Xfinity Wi-Fi Hotspot Coverage) [Part 2]

This is the second of a two-part series. Part 1 set up the story and goes into how to discover, digest & reformat the necessary data. This concluding segment will show how to perform some basic visualizations and then how to build beautiful & informative density maps from the data and offer some suggestions as to how to...

Read more »

Can You Track Me Now? (Visualizing Xfinity Wi-Fi Hotspot Coverage) [Part 1]

June 6, 2014
By
Can You Track Me Now? (Visualizing Xfinity Wi-Fi Hotspot Coverage) [Part 1]

This is the first of a two-part series. Part 1 sets up the story and goes into how to discover, digest & reformat the necessary data. Part 2 will show how to perform some basic visualizations and then how to build beautiful & informative density maps from the data and offer some suggestions as to how to prevent potential tracking. Xfinity...

Read more »

Vectorizing IPv4 Address Conversions – Part 2

May 17, 2014
By
Vectorizing IPv4 Address Conversions – Part 2

The previous post looked at using the Vectorize() function to, well, vectorize, our Rcpp IPv4 functions. While this is a completely acceptable practice, we can perform the vectorization 100% in Rcpp/C++. We’ve included both the original Rcpp IPv4 functions and the new Rcpp-vectorized functions together to show the minimal differences between them: #include <Rcpp.h> #include <boost/asio/ip/address_v4.hpp> using namespace Rcpp; using namespace boost::asio::ip; // Rcpp/C++ vectorized routines // ] NumericVector rcpp_rinet_pton (CharacterVector...

Read more »

Vectorizing IPv4 Address Conversions – Part 1

May 16, 2014
By

Our previous post showed how to speed up the conversion of IPv4 addresses to/from integer format by taking advantage of a simple Rcpp wrapper to “boosted” native functions. However, to convert more than one IP address, you need to stick those functions into one of the R *apply functions, which does the job, but is not an optimal...

Read more »

Speeding Up IPv4 Address Conversion in R

May 14, 2014
By

In our book we provide examples of how to convert IPv4 addresses to integer format (and back). We held ourselves to using only basic R functionality since the book had to be at an introductory level. On a fairly modern box, the ip2long function takes (roughly) 0.1s to convert 4,000 IPv4 address to integers (I just happened...

Read more »