R: add test.

Closes #1007.