View source: R/correlated_vars.R

correlated_vars | R Documentation |

Generate correlated variables using a vector of know values and desired maximum and minimum correlations

correlated_vars( y, min_cor = -1, max_cor = 1, nvars, constant = NULL, operation = "*", x = NULL )

`y` |
A vector to generate variables correlated with. |

`min_cor` |
The minimum desired correlation. |

`max_cor` |
The maximum desired correlation. |

`nvars` |
The number of variables. |

`constant` |
A constant. Use |

`operation` |
The operation to be applied to the |

`x` |
An optional vector of the same length of |

A data frame with the `y`

variable and the correlated variables.

Tiago Olivoto tiagoolivoto@gmail.com

library(metan) y <- rnorm(n = 10) cor_vars <- correlated_vars(y, nvar = 6) plot(cor_vars)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.