Skip to content

Commit

Permalink
Merge pull request #61 from edgararuiz/cran-rel
Browse files Browse the repository at this point in the history
CRAN release prep
  • Loading branch information
edgararuiz authored Jun 28, 2018
2 parents 318ec18 + 5a92e54 commit eec949f
Show file tree
Hide file tree
Showing 117 changed files with 205 additions and 735 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
^\.Rprofile$
^packrat/
^to-cor-df\.png$
revdep
9 changes: 4 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ language: R
sudo: false
cache: packages

r_github_packages:
- jimhester/covr

after_success:
- Rscript -e 'covr::codecov()'
include:
- r: release
- r: oldrel
- r: devel
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: corrr
Type: Package
Version: 0.2.1.9000
Version: 0.3.0
Title: Correlations in R
Description: A tool for exploring correlations.
It makes it possible to easily perform routine tasks when
Expand All @@ -16,8 +16,7 @@ Authors@R: c(
URL: https://github.com/drsimonj/corrr
BugReports: https://github.com/drsimonj/corrr/issues
Depends:
R (>= 3.3.0),
dplyr (>= 0.5.0)
R (>= 3.3.0)
LazyData: yes
License: MIT + file LICENSE
RoxygenNote: 6.0.1
Expand All @@ -29,6 +28,7 @@ Suggests:
DBI,
RSQLite
Imports:
dplyr (>= 0.5.0),
magrittr (>= 1.5),
tidyr (>= 0.5.1),
ggplot2 (>= 2.2.0),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# corrr 0.2.1.9000
# corrr 0.3.0

## Small breaking changes

Expand Down Expand Up @@ -28,6 +28,8 @@ The `diagonal` argument of `as_matrix` and `as_matrix.cor_df` is now an optional

- During the development of this version, ggplot v2.2.0 was released. Many changes in the plotting functions have been made to handle new features in the updated version of ggplot2.

- Improvements to the package folder structure

# corrr 0.2.1

## New Functionality
Expand Down
1 change: 1 addition & 0 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @export
#' @examples
#' # Examples with correlate()
#' library(dplyr)
#' mtcars %>% correlate() %>% fashion()
#' mtcars %>% correlate() %>% fashion(decimals = 1)
#' mtcars %>% correlate() %>% fashion(leading_zeros = TRUE)
Expand Down
2 changes: 2 additions & 0 deletions R/reshape.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#' @return A tbl or, if mirror = TRUE, a cor_df (see \code{\link{correlate}}).
#' @export
#' @examples
#' library(dplyr)
#' x <- correlate(mtcars)
#' focus(x, mpg, cyl) # Focus on correlations of mpg and cyl with all other variables
#' focus(x, -disp, - mpg, mirror = TRUE) # Remove disp and mpg from columns and rows
Expand Down Expand Up @@ -48,6 +49,7 @@ focus_ <- function(x, ..., .dots, mirror) {
#' @return A tibble or, if mirror = TRUE, a correlation data frame.
#' @export
#' @examples
#' library(dplyr)
#' any_greater_than <- function(x, val) {
#' mean(abs(x), na.rm = TRUE) > val
#' }
Expand Down
Binary file removed README-combination-1.png
Binary file not shown.
Binary file removed README-combination-2.png
Binary file not shown.
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ output: github_document
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
fig.path = "tools/readme/"
)
```

Expand All @@ -24,7 +24,7 @@ knitr::opts_chunk$set(

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](http://tidyverse.org/). This, along with the primary corrr functions, is represented below:

<img src='to-cor-df.png'>
<img src='tools/readme/to-cor-df.png'>

You can install:

Expand Down
109 changes: 67 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,85 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# corrr <img src="man/figures/logo.png" align="right" />

[![Project Status: Active ? The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![minimal R version](https://img.shields.io/badge/R%3E%3D-3.3.0-6666ff.svg)](https://cran.r-project.org/) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/corrr)](https://cran.r-project.org/package=corrr) [![packageversion](https://img.shields.io/badge/Package%20version-0.2.1.9000-orange.svg?style=flat-square)](commits/master) [![Last-changedate](https://img.shields.io/badge/last%20change-2017--02--03-yellowgreen.svg)](/commits/master) [![Build Status](https://travis-ci.org/drsimonj/corrr.svg?branch=master)](https://travis-ci.org/drsimonj/corrr) [![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/corrr)](http://cran.rstudio.com/web/packages/corrr/index.html)

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](http://tidyverse.org/). This, along with the primary corrr functions, is represented below:

<img src='to-cor-df.png'>
[![Project Status: Active ? The project has reached a stable, usable
state and is being actively
developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
[![minimal R
version](https://img.shields.io/badge/R%3E%3D-3.3.0-6666ff.svg)](https://cran.r-project.org/)
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/corrr)](https://cran.r-project.org/package=corrr)
[![packageversion](https://img.shields.io/badge/Package%20version-0.2.1.9000-orange.svg?style=flat-square)](commits/master)
[![Last-changedate](https://img.shields.io/badge/last%20change-2018--05--28-yellowgreen.svg)](/commits/master)
[![Build
Status](https://travis-ci.org/drsimonj/corrr.svg?branch=master)](https://travis-ci.org/drsimonj/corrr)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/corrr)](http://cran.rstudio.com/web/packages/corrr/index.html)

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](http://tidyverse.org/).
This, along with the primary corrr functions, is represented below:

<img src='tools/readme/to-cor-df.png'>

You can install:

- the latest released version from CRAN with
- the latest released version from CRAN with

<!-- end list -->

``` r
install.packages("corrr")
```

- the latest development version from github with
- the latest development version from github
with

<!-- end list -->

``` r
install.packages("devtools") # run this line if devtools is not installed
devtools::install_github("drsimonj/corrr")
```

Using 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:
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 "rowname" column
- Standardised variances (the matrix diagonal) set to missing values (`NA`) so they can be ignored.
- A `tbl` with an additional class, `cor_df`
- An extra “rowname” column
- Standardised 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:
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 NA).
- `rearrange()` the columns and rows based on correlation strengths.
- `shave()` the upper or lower triangle (set to 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.
- `focus()` on select columns and rows.
- `stretch()` into a long format.

Output/visualisations (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.
- `fashion()` the correlations for pretty printing.
- `rplot()` the correlations with shapes in place of the values.
- `network_plot()` the correlations in a network.

Examples
--------
## Examples

``` r
library(MASS)
Expand Down Expand Up @@ -83,31 +109,30 @@ x <- correlate(d)
class(x)
#> [1] "cor_df" "tbl_df" "tbl" "data.frame"
x
#> # A tibble: 6 × 7
#> rowname v1 v2 v3 v4 v5
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 v1 NA 0.70986371 0.709330652 0.0001947192 0.021359764
#> 2 v2 0.7098637068 NA 0.697411266 -0.0132575510 0.009280530
#> 3 v3 0.7093306516 0.69741127 NA -0.0252752456 0.001088652
#> 4 v4 0.0001947192 -0.01325755 -0.025275246 NA 0.421380212
#> 5 v5 0.0213597639 0.00928053 0.001088652 0.4213802123 NA
#> 6 v6 -0.0435135083 -0.03383145 -0.020057495 0.4424697437 0.425441795
#> # ... with 1 more variables: v6 <dbl>
#> # A tibble: 6 x 7
#> rowname v1 v2 v3 v4 v5 v6
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 v1 NA 0.710 0.709 0.000195 0.0214 -0.0435
#> 2 v2 0.710 NA 0.697 -0.0133 0.00928 -0.0338
#> 3 v3 0.709 0.697 NA -0.0253 0.00109 -0.0201
#> 4 v4 0.000195 -0.0133 -0.0253 NA 0.421 0.442
#> 5 v5 0.0214 0.00928 0.00109 0.421 NA 0.425
#> 6 v6 -0.0435 -0.0338 -0.0201 0.442 0.425 NA
```

As a `tbl`, we can use functions from data frame packages like `dplyr`, `tidyr`, `ggplot2`:
As a `tbl`, we can use functions from data frame packages like `dplyr`,
`tidyr`, `ggplot2`:

``` r
library(dplyr)

# Filter rows by correlation size
x %>% filter(v1 > .6)
#> # A tibble: 2 × 7
#> rowname v1 v2 v3 v4 v5
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 v2 0.7098637 NA 0.6974113 -0.01325755 0.009280530
#> 2 v3 0.7093307 0.6974113 NA -0.02527525 0.001088652
#> # ... with 1 more variables: v6 <dbl>
#> # A tibble: 2 x 7
#> rowname v1 v2 v3 v4 v5 v6
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 v2 0.710 NA 0.697 -0.0133 0.00928 -0.0338
#> 2 v3 0.709 0.697 NA -0.0253 0.00109 -0.0201
```

corrr functions work in pipelines (`cor_df` in; `cor_df` or `tbl` out):
Expand Down Expand Up @@ -136,7 +161,7 @@ fashion(x)
rplot(x)
```

![](README-combination-1.png)
![](tools/readme/combination-1.png)<!-- -->

``` r

Expand All @@ -148,4 +173,4 @@ datasets::airquality %>%
#> Missing treated using: 'pairwise.complete.obs'
```

![](README-combination-2.png)
![](tools/readme/combination-2.png)<!-- -->
Binary file not shown.
Binary file removed README_files/figure-markdown_github/rplot-1.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
37 changes: 20 additions & 17 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
## Test environments
* local Windows 10 install, R 3.3.1
* ubuntu 12.04.5 LTS (on travis-ci), R 3.3.1
* win-builder (devel and release)
## Release summary

## R CMD check results
- `as_cordf` will coerce lists or matrices into correlation data frames if possible

- `focus_if` enables conditional variable selection

- Can use arithmetic operators (e.g., `+` or `-`) with correlation data frames

- `correlate()` now supports data frame with a SQL back-end (`tbl_sql`)

Except for win-builder, there were no ERRORs, WARNINGs or NOTEs.
- Small breaking change: The `diagonal` argument of `as_matrix` and `as_matrix.cor_df` is now an optional argument rather than set to `1` by default

Via win-builder, there was 1 NOTE:
- Other improvements and fixes

## Test environments
* local Windows 10 install, R 3.5.0
* ubuntu 14.04 (on travis-ci)
* Ubuntu 14.04.5 LTS with RStudio Server, R 3.4.3

## R CMD check results

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Simon Jackson <[email protected]>'

License components with restrictions and base license permitting such:
MIT + file LICENSE
File 'LICENSE':
YEAR: 2016
COPYRIGHT HOLDER: Simon Jackson
- 0 errors | 0 warnings | 0 notes

## Downstream dependencies
## revdep check results

There are currently no downstream dependencies for this package.
- 0 packages
1 change: 1 addition & 0 deletions man/fashion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/focus.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions man/focus_if.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit eec949f

Please sign in to comment.