Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Tidier.jl to a meta-package #115

Merged
merged 6 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: julia-actions/setup-julia@v1
- uses: julia-actions/cache@v1
with:
cache-registries: "true"
cache-registries: "false"
- name: Install documentation dependencies
run: julia --project=docs -e 'using Pkg; pkg"dev ."; Pkg.instantiate()'
- name: Build and deploy
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Tidier.jl updates

## v1.0.0 - 2023-08-07
- Convert Tidier.jl to a meta-package that only re-exports other Tidier packages

## v0.7.7 - 2023-07-15
- Added documentation on how to interpolate variables inside of `for` loops. Note: `!!` interpolation doesn't work inside of `for` loops because macros are expanded during parsing and not at runtime.
- Fixed bug in `parse_pivot_arg()` to enable interpolation inside of pivoting functions when used inside a `for` loop.
Expand Down
24 changes: 12 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name = "Tidier"
uuid = "f0413319-3358-4bb0-8e7c-0c83523a93bd"
authors = ["Karandeep Singh"]
version = "0.7.7"
version = "1.0.0"

[deps]
Chain = "8be319e6-bccf-4806-a6f7-6fae938471bc"
Cleaner = "caabdcdb-0ab6-47cf-9f62-08858e44f38f"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
ShiftedArrays = "1277b4bf-5013-50f5-be3d-901d8477a67a"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TidierCats = "79ddc9fe-4dbf-4a56-a832-df41fb326d23"
TidierData = "fe2206b3-d496-4ee9-a338-6a095c4ece80"
TidierDates = "20186a3f-b5d3-468e-823e-77aae96fe2d8"
TidierPlots = "337ecbd1-5042-4e2a-ae6f-ca776f97570a"
TidierStrings = "248e6834-d0f8-40ef-8fbb-8e711d883e9c"

[compat]
Chain = "0.5"
Cleaner = "0.5.0"
DataFrames = "1.5"
MacroTools = "0.5"
Reexport = "0.2, 1"
ShiftedArrays = "2.0.0"
TidierData = ">=0.9.2"
TidierPlots = ">=0.1.0"
TidierCats = ">=0.1.1"
TidierDates = ">=0.1.0"
TidierStrings = ">=0.1.0"

julia = "1.6"

[extras]
Expand Down
148 changes: 48 additions & 100 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,53 @@
[![Build Status](https://github.com/TidierOrg/Tidier.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/TidierOrg/Tidier.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/Tidier&label=Downloads)](https://pkgs.genieframework.com?packages=Tidier)

<img src="/docs/src/assets/Tidier_jl_logo.png" align="right" style="padding-left:10px;" width="150"/>

## What is Tidier.jl?

Tidier.jl is a 100% Julia implementation of the R tidyverse
mini-language in Julia. Powered by the DataFrames.jl package and Julia’s
extensive meta-programming capabilities, Tidier.jl is an R user’s love
letter to data analysis in Julia.

`Tidier.jl` has three goals, which differentiate it from other data analysis
meta-packages in Julia:

1. **Stick as closely to tidyverse syntax as possible:** Whereas other
meta-packages introduce Julia-centric idioms for working with
DataFrames, this package’s goal is to reimplement parts of tidyverse
in Julia. This means that `Tidier.jl` uses *tidy expressions* as opposed
to idiomatic Julia expressions. An example of a tidy expression is
`a = mean(b)`.

2. **Make broadcasting mostly invisible:** Broadcasting trips up many R
users switching to Julia because R users are used to most functions
being vectorized. `Tidier.jl` currently uses a lookup table to decide
which functions *not* to vectorize; all other functions are
automatically vectorized. Read the documentation page on "Autovectorization"
to read about how this works, and how to override the defaults.

3. **Make scalars and tuples mostly interchangeable:** In Julia, the function
`across(a, mean)` is dispatched differently than `across((a, b), mean)`.
The first argument in the first instance above is treated as a scalar,
whereas the second instance is treated as a tuple. This can be very confusing
to R users because `1 == c(1)` is `TRUE` in R, whereas in Julia `1 == (1,)`
evaluates to `false`. The design philosophy in `Tidier.jl` is that the user
should feel free to provide a scalar or a tuple as they see fit anytime
multiple values are considered valid for a given argument, such as in
`across()`, and `Tidier.jl` will figure out how to dispatch it.
<a href="https://tidierorg.github.io/Tidier.jl/dev/"><img src="https://raw.githubusercontent.com/TidierOrg/Tidier.jl/main/docs/src/assets/Tidier_jl_logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://tidierorg.github.io/Tidier.jl/dev/">Tidier.jl</a>

Tidier.jl is a 100% Julia implementation of the R tidyverse meta-package. Similar to the R tidyverse, Tidier.jl re-exports several other packages, each focusing on a specific set of functionalities.

<br><br>

<a href="https://tidierorg.github.io/TidierData.jl/latest/"><img src="https://raw.githubusercontent.com/TidierOrg/TidierData.jl/b3b8886eac075264fe1a6c44894fd8af123ce933/docs/src/assets/Tidier_jl_logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://tidierorg.github.io/TidierData.jl/latest/">TidierData.jl</a>

TidierData.jl is package dedicated to data transformation and reshaping, powered by DataFrames.jl, ShiftedArrays.jl, and Cleaner.jl. It focuses on functionality within the dplyr, tidyr, and janitor R packages.

<br><br>

<a href="https://github.com/TidierOrg/TidierPlots.jl"><img src="https://raw.githubusercontent.com/TidierOrg/TidierPlots.jl/main/assets/logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://github.com/TidierOrg/TidierPlots.jl">TidierPlots.jl</a>

TidierPlots.jl is a package dedicated to plotting, powered by AlgebraOfGraphics.jl. It focuses on functionality within the ggplot2 R package.

<br><br>

<a href="https://tidierorg.github.io/TidierCats.jl/dev/"><img src="https://raw.githubusercontent.com/TidierOrg/TidierCats.jl/main/docs/src/assets/TidierCats_logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://tidierorg.github.io/TidierCats.jl/dev/">TidierCats.jl</a>

TidierCats.jl is a package dedicated to handling categorical variables, powered by CategoricalArrays.jl. It focuses on functionality within the forcats R package.

<br><br>

<a href="https://github.com/TidierOrg/TidierDates.jl"><img src="https://raw.githubusercontent.com/TidierOrg/TidierDates.jl/main/docs/src/assets/TidierDates_logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://github.com/TidierOrg/TidierDates.jl">TidierDates.jl</a>

TidierDates.jl is a package dedicated to handling dates and times. It focuses on functionality within the lubridate R package.

<br><br>

<a href="https://tidierorg.github.io/TidierStrings.jl/dev/"><img src="https://raw.githubusercontent.com/TidierOrg/TidierStrings.jl/main/docs/src/assets/TidierStrings_logo.png" align="left" style="padding-right:10px;" width="150"></img></a>

## <a href="https://tidierorg.github.io/TidierStrings.jl/dev/">TidierStrings.jl</a>

TidierStrings.jl is a package dedicated to handling strings. It focuses on functionality within the stringr R package.

<br><br>

## Installation

Expand Down Expand Up @@ -72,74 +84,10 @@ using Pkg
Pkg.add(url="https://github.com/TidierOrg/Tidier.jl")
```

## What functions does Tidier.jl support?

To support R-style programming, Tidier.jl is implemented using macros.

Tidier.jl currently supports the following top-level macros:

- `@glimpse()`
- `@select()`, `@rename()`, and `@distinct()`
- `@mutate()` and `@transmute()`
- `@summarize()` and `@summarise()`
- `@filter()` and `@slice()`
- `@group_by()` and `@ungroup()`
- `@arrange()`
- `@pull()`
- `@count()` and `@tally()`
- `@left_join()`, `@right_join()`, `@inner_join()`, and `@full_join()`
- `@bind_rows()` and `@bind_cols()`
- `@pivot_wider()` and `@pivot_longer()`
- `@drop_na()`
- `@clean_names()` (as in R's `janitor::clean_names()` function)

Tidier.jl also supports the following helper functions:

- `across()`
- `desc()`
- `if_else()` and `case_when()`
- `n()` and `row_number()`
- `ntile()`
- `lag()` and `lead()`
- `starts_with()`, `ends_with()`, `matches()`, and `contains()`
- `as_float()`, `as_integer()`, and `as_string()`

See the documentation [Home](https://tidierorg.github.io/Tidier.jl/dev/) page for a guide on how to get started, or the [Reference](https://tidierorg.github.io/Tidier.jl/dev/reference/) page for a detailed guide to each of the macros and functions.

## Example

Let's select the first five movies in our dataset whose budget exceeds the mean budget. Unlike in R, where we pass an `na.rm = TRUE` argument to remove missing values, in Julia we wrap the variable with a `skipmissing()` to remove the missing values before the `mean()` is calculated.

```julia
using Tidier
using RDatasets

movies = dataset("ggplot2", "movies");

@chain movies begin
@mutate(Budget = Budget / 1_000_000)
@filter(Budget >= mean(skipmissing(Budget)))
@select(Title, Budget)
@slice(1:5)
end
```

```
5×2 DataFrame
Row │ Title Budget
│ String Float64?
─────┼──────────────────────────────────────
1 │ 'Til There Was You 23.0
2 │ 10 Things I Hate About You 16.0
3 │ 102 Dalmatians 85.0
4 │ 13 Going On 30 37.0
5 │ 13th Warrior, The 85.0
```

## What’s new

See [NEWS.md](https://github.com/TidierOrg/Tidier.jl/blob/main/NEWS.md) for the latest updates.

## What's missing

Is there a tidyverse feature missing that you would like to see in Tidier.jl? Please file a GitHub issue. Because Tidier.jl primarily wraps DataFrames.jl, our decision to integrate a new feature will be guided by how well-supported it is within DataFrames.jl and how likely other users are to benefit from it.
Is there a tidyverse feature missing that you would like to see in Tidier.jl? Please file a GitHub issue.
36 changes: 0 additions & 36 deletions docs/examples/UserGuide/across.jl

This file was deleted.

26 changes: 0 additions & 26 deletions docs/examples/UserGuide/arrange.jl

This file was deleted.

44 changes: 0 additions & 44 deletions docs/examples/UserGuide/autovec.jl

This file was deleted.

29 changes: 0 additions & 29 deletions docs/examples/UserGuide/binding.jl

This file was deleted.

Loading