Round robin in R

I found a line in the genetics package that looks like this:

P <- D <- Dprime <- nobs <- chisq <- p.value <- corr <- R.2 <- P 

note P both at the beginning and at the end. What does it mean?

+7
source share
1 answer

This construct assigns the values โ€‹โ€‹of P variables with each of the other names indicated on the line <- s. This assignment will occur in the current environment.

Thus, if a variable with the name P in the rightmost value is not in the current environment, a new variable P will be created in the current environment.

To see this in action, run the following from a new R session:

 ls() # character(0) mean <- a <- b <- mean ls() # [1] "a" "b" "mean" 
+7
source

All Articles