Wrap system calls in R