Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 18 committers (11.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (19.1%) to scientific vocabulary
Keywords from Contributors
tidy-data
setup
tidyverse
Last synced: 11 months ago
·
JSON representation
Repository
Explore correlations in R
Basic Info
- Host: GitHub
- Owner: tidymodels
- License: other
- Language: R
- Default Branch: main
- Homepage: https://corrr.tidymodels.org
- Size: 77.6 MB
Statistics
- Stars: 594
- Watchers: 18
- Forks: 58
- Open Issues: 21
- Releases: 10
Created about 10 years ago
· Last pushed 12 months ago
Metadata Files
Readme
Contributing
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# corrr
[](https://github.com/tidymodels/corrr/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=corrr)
[](https://app.codecov.io/gh/tidymodels/corrr?branch=main)
corrr is a package for exploring **corr**elations in **R**. It focuses on creating and working with **data frames** of correlations (instead of matrices) that can be easily explored via corrr functions or by leveraging tools like those in the [tidyverse](https://www.tidyverse.org/). This, along with the primary corrr functions, is represented below:
You can install:
- the latest released version from CRAN with
```{r install_cran, eval = FALSE}
install.packages("corrr")
```
- the latest development version from GitHub with
```{r install_git, eval = FALSE}
# install.packages("remotes")
remotes::install_github("tidymodels/corrr")
```
## Using corrr
Using `corrr` typically starts with `correlate()`, which acts like the base correlation function `cor()`. It differs by defaulting to pairwise deletion, and returning a correlation data frame (`cor_df`) of the following structure:
- A `tbl` with an additional class, `cor_df`
- An extra "term" column
- Standardized variances (the matrix diagonal) set to missing values (`NA`) so they can be ignored.
### API
The corrr API is designed with data pipelines in mind (e.g., to use `%>%` from the magrittr package). After `correlate()`, the primary corrr functions take a `cor_df` as their first argument, and return a `cor_df` or `tbl` (or output like a plot). These functions serve one of three purposes:
Internal changes (`cor_df` out):
- `shave()` the upper or lower triangle (set to `r NA`).
- `rearrange()` the columns and rows based on correlation strengths.
Reshape structure (`tbl` or `cor_df` out):
- `focus()` on select columns and rows.
- `stretch()` into a long format.
Output/visualizations (console/plot out):
- `fashion()` the correlations for pretty printing.
- `rplot()` the correlations with shapes in place of the values.
- `network_plot()` the correlations in a network.
## Databases and Spark
The `correlate()` function also works with database tables. The function will automatically push the calculations of the correlations to the database, collect the results in R, and return the `cor_df` object. This allows for those results integrate with the rest of the `corrr` API.
## Examples
```{r example, message = FALSE, warning = FALSE}
library(MASS)
library(corrr)
set.seed(1)
# Simulate three columns correlating about .7 with each other
mu <- rep(0, 3)
Sigma <- matrix(.7, nrow = 3, ncol = 3) + diag(3)*.3
seven <- mvrnorm(n = 1000, mu = mu, Sigma = Sigma)
# Simulate three columns correlating about .4 with each other
mu <- rep(0, 3)
Sigma <- matrix(.4, nrow = 3, ncol = 3) + diag(3)*.6
four <- mvrnorm(n = 1000, mu = mu, Sigma = Sigma)
# Bind together
d <- cbind(seven, four)
colnames(d) <- paste0("v", 1:ncol(d))
# Insert some missing values
d[sample(1:nrow(d), 100, replace = TRUE), 1] <- NA
d[sample(1:nrow(d), 200, replace = TRUE), 5] <- NA
# Correlate
x <- correlate(d)
class(x)
x
```
**NOTE: Previous to corrr 0.4.3, the first column of a `cor_df` dataframe was named "rowname". As of corrr 0.4.3, the name of this first column changed to "term".**
As a `tbl`, we can use functions from data frame packages like `dplyr`, `tidyr`, `ggplot2`:
```{r, message = FALSE, warning = FALSE}
library(dplyr)
# Filter rows by correlation size
x %>% filter(v1 > .6)
```
corrr functions work in pipelines (`cor_df` in; `cor_df` or `tbl` out):
```{r combination, warning = FALSE, fig.height = 4, fig.width = 5}
x <- datasets::mtcars %>%
correlate() %>% # Create correlation data frame (cor_df)
focus(-cyl, -vs, mirror = TRUE) %>% # Focus on cor_df without 'cyl' and 'vs'
rearrange() %>% # rearrange by correlations
shave() # Shave off the upper triangle for a clean result
fashion(x)
rplot(x)
datasets::airquality %>%
correlate() %>%
network_plot(min_cor = .2)
```
## Contributing
This project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
- For questions and discussions about tidymodels packages, modeling, and machine learning, please [post on RStudio Community](https://community.rstudio.com/new-topic?category_id=15&tags=tidymodels,question).
- If you think you have encountered a bug, please [submit an issue](https://github.com/tidymodels/corrr/issues).
- Either way, learn how to create and share a [reprex](https://reprex.tidyverse.org/articles/articles/learn-reprex.html) (a minimal, reproducible example), to clearly communicate about your code.
- Check out further details on [contributing guidelines for tidymodels packages](https://www.tidymodels.org/contribute/) and [how to get help](https://www.tidymodels.org/help/).
Owner
- Name: tidymodels
- Login: tidymodels
- Kind: organization
- Repositories: 59
- Profile: https://github.com/tidymodels
GitHub Events
Total
- Issues event: 1
- Watch event: 8
- Issue comment event: 2
- Push event: 2
- Pull request event: 2
- Fork event: 2
Last Year
- Issues event: 1
- Watch event: 8
- Issue comment event: 2
- Push event: 2
- Pull request event: 2
- Fork event: 2
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| drsimonj | d****n@g****m | 147 |
| Edgar Ruiz | e****r@r****m | 40 |
| Julia Silge | j****e@g****m | 34 |
| Edgar Ruiz | e****z@g****m | 21 |
| topepo | m****n@g****m | 20 |
| Daryn Ramsden | t****n@g****m | 14 |
| cimentadaj | c****j@g****m | 13 |
| James Laird-Smith | j****h@g****m | 6 |
| Kirill Müller | k****r@m****g | 5 |
| Simon Jackson | s****n@b****m | 4 |
| Emil Hvitfeldt | e****t@g****m | 3 |
| jsta | s****2@m****u | 2 |
| Antoine Sachet | a****c@g****m | 1 |
| Hannah Frick | h****k@g****e | 1 |
| Michael Grund | 2****d | 1 |
| Michael Grund | m****d@i****m | 1 |
| Matthew T. Warkentin | m****n@m****a | 1 |
| Samuel Scherrer | s****r@p****e | 1 |
Committer Domains (Top 20 + Academic)
posteo.de: 1
mail.utoronto.ca: 1
innoplexia.com: 1
gmx.de: 1
msu.edu: 1
booking.com: 1
mailbox.org: 1
rstudio.com: 1
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 74
- Total pull requests: 39
- Average time to close issues: 3 months
- Average time to close pull requests: about 1 month
- Total issue authors: 48
- Total pull request authors: 13
- Average comments per issue: 2.84
- Average comments per pull request: 1.95
- Merged pull requests: 34
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 2
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 1
- Average comments per issue: 0.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- drsimonj (20)
- EmilHvitfeldt (2)
- luifrancgom (2)
- vertesy (2)
- jmbarbone (2)
- joe-chelladurai (2)
- jcberny (2)
- cimentadaj (2)
- aljoscha-j (1)
- ttriche (1)
- duleise (1)
- joaomaroco (1)
- jagodap (1)
- slhck (1)
- zx8754 (1)
Pull Request Authors
- edgararuiz-zz (8)
- juliasilge (6)
- EmilHvitfeldt (5)
- thisisdaryn (5)
- topepo (4)
- krlmlr (3)
- cimentadaj (3)
- mhahsler (2)
- jmbarbone (1)
- michaelgrund (1)
- jsta (1)
- jameslairdsmith (1)
- hfrick (1)
Top Labels
Issue Labels
feature (7)
bug (5)
upkeep (1)
reprex (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 7,815 last-month
- Total docker downloads: 9,985
-
Total dependent packages: 8
(may contain duplicates) -
Total dependent repositories: 47
(may contain duplicates) - Total versions: 19
- Total maintainers: 1
proxy.golang.org: github.com/tidymodels/corrr
- Documentation: https://pkg.go.dev/github.com/tidymodels/corrr#section-documentation
- License: other
-
Latest release: v0.4.4
published almost 4 years ago
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced:
12 months ago
cran.r-project.org: corrr
Correlations in R
- Homepage: https://github.com/tidymodels/corrr
- Documentation: http://cran.r-project.org/web/packages/corrr/corrr.pdf
- License: MIT + file LICENSE
-
Latest release: 0.4.5
published 12 months ago
Rankings
Stargazers count: 0.6%
Forks count: 1.3%
Dependent repos count: 3.7%
Downloads: 3.9%
Dependent packages count: 6.1%
Average: 6.5%
Docker downloads count: 23.7%
Maintainers (1)
Last synced:
11 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.4 depends
- dplyr >= 1.0.0 imports
- ggplot2 >= 2.2.0 imports
- ggrepel >= 0.6.5 imports
- glue >= 1.4.2 imports
- purrr >= 0.2.2 imports
- rlang >= 0.4.0 imports
- seriation >= 1.2 imports
- tibble >= 2.0 imports
- DBI * suggests
- RSQLite * suggests
- covr * suggests
- dbplyr >= 1.2.1 suggests
- knitr >= 1.13 suggests
- rmarkdown >= 0.9.6 suggests
- sparklyr >= 0.9 suggests
- testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/lock.yaml
actions
- dessant/lock-threads v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite