## Exclamation point in r

## Inequalities in r

R Studio is currently available for download in version 0.99.442. I strongly advise updating to the most recent update, as there has been a significant amount of new features added. Here are a few examples of the latest features:

Some of the parameters you could add to a function have built-in auto-fill. I’m beginning to add ‘xlim’ to define the x-axis limits of my plot in the picture below. My full coding could look like this: “xlim = c(0, 6)”. To see a larger version of the dialog box, click on the image below.

I’m calling the function lm (for linear regression) in the picture below, but there’s no other argument after the comma. The built-in debugging says there’s a “missing argument to function call” when I hover the mouse over the yellow triangle exclamation mark. This is AMAZING!!!

## Is.na r

The first obviously means “if NOT gamma is Null.” I’m not sure what the third means – it looks like it says “if NOT gamma,” but there’s no equals symbol, is.null, or anything like that after it.

Since this !gamma follows is.logical(gamma) && …, it will only be evaluated if gamma is a logical (TRUE/FALSE) value. !gamma is similar to gamma==FALSE in this case, but most programmers will shorten it to!gamma (so that FALSE becomes TRUE and TRUE becomes FALSE).

We shouldn’t test gamma=FALSE without first running the is.logical() test, since someone might have stated gamma=0, in which case R will evaluate 0==FALSE, which is TRUE according to its coercion laws.

### R bitwise or

The first obviously means “if NOT gamma is Null.” I’m not sure what the third means – it looks like it says “if NOT gamma,” but there’s no equals symbol, is.null, or anything like that after it.

Since is.logical(gamma) &&… follows this!gamma, it can only be evaluated if gamma is a logical (TRUE/FALSE) attribute. !gamma is similar to gamma==FALSE in this case, but most programmers will shorten it to!gamma (so that FALSE becomes TRUE and TRUE becomes FALSE).

We wouldn’t want to test gamma=FALSE without the is.logical() test first, since someone may have stated gamma=0, in which case R might evaluate 0==FALSE, which according to its coercion rules is TRUE.

### Equal sign in r

After dplyr 0.6.0, a new way of working with NSE called tidyeval has been added. The question “why bother” is present in any subject that demands our attention. “You’ll need this stuff if you want to lock dplyr verbs within a feature,” is the only answer. Once you’ve gotten a feel for dplyr and friends, the next logical step is to apply the concepts to more “programming” tasks, such as writing functions.

Consider the following scenario: we want a function that takes two numeric vectors (i.e., two groups), performs all pairwise comparisons (>), and returns the proportion of the first group that is ‘favorable.’ For example, 16 of the 20 comparisons showed that group1 was superior to group2. As a result, the “proportion of favorable comparisons” is 16/20 or.8. This metric can be used to calculate the effect size of the Mann Whitney U Test, Wilcoxon Test, or even a rank biserial correlation. For more information and history, see Kerby 2014’s paper on the “Simple Difference Formula.”

In the final step, we combine the two vectors into a Cartesian product and compare each element. To put it another way, equate the first value of group 1 to the first value of group 2. Choose the greater of the two options. Continue to compare value 1 to the other values in group 2. Then repeat with the rest of group 1’s values in the same manner.