Fix R package installation code for failures