R global variables.

This is one of the annoying features of R. What it means is this. You defined a function. And accidentally there is an undefined variable in the function. Then R does not stop but keep looking for the variable and use one if there is one in the environment that called the function. It makes debugging very hard.

Here is how to minimize it.

1. Use codetools to scan your function.

Codetools

2. Use a prefix for all your variables in a function so that any mistakes can be seen easily.

Hope to write more about it later but now, just want to post a solution.

R global variables. This is one of th …
Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *