R package installation now cd's to valid directory first.

This solves the random failures while installing R packages.

The issue was that after some build types (e.g. autoconf), the temporary build directory would be removed, and thus the current working directory would become invalid. This caused issues for the R package installer because it performs some shell initialization first.

Fixes #27.