Following #2737 this error is now a name error

Tiny fix to an error I'm seeing in the R test suite following the merge of #2737. This makes perfect sense
since the point of that pull request was to change this to a NameError.