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
1 of 11 committers (9.1%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.3%) to scientific vocabulary
Keywords
animation
plotting
rstats
transition
tweening
Keywords from Contributors
visualisation
package-creation
tidy-data
book
bookdown
data-manipulation
documentation-tool
date-time
shiny
network-analysis
Last synced: 6 months ago
·
JSON representation
Repository
Interpolate your data
Basic Info
- Host: GitHub
- Owner: thomasp85
- License: other
- Language: R
- Default Branch: main
- Size: 2.82 MB
Statistics
- Stars: 399
- Watchers: 15
- Forks: 43
- Open Issues: 3
- Releases: 5
Topics
animation
plotting
rstats
transition
tweening
Created about 10 years ago
· Last pushed almost 2 years ago
Metadata Files
Readme
License
README.Rmd
---
output: github_document
---
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
dev = 'jpeg',
ffmpeg.format='gif',
interval = 1/15
)
library(magrittr)
```
# tweenr
[](https://github.com/thomasp85/tweenr/actions/workflows/R-CMD-check.yaml)
[](https://CRAN.R-project.org/package=tweenr) [](https://CRAN.R-project.org/package=tweenr)
## What is this?
`tweenr` is a package for interpolating data, mainly for animations. It provides
a range of functions that take data of different forms and calculate
intermediary values. It supports all atomic vector types along with `factor`,
`Date`, `POSIXct`, characters representing colours, and `list`. `tweenr` is used
extensibly by [`gganimate`](https://github.com/thomasp85/gganimate) to create
smooth animations, but can also be used by itself to prepare data for animation
in another framework.
## How do I get it?
`tweenr` is available on CRAN and can be installed with
`install.packages('tweenr')`. In order to get the development version you can
install it from github with `devtools`
```{r, eval=FALSE}
#install.packages('devtools')
devtools::install_github('thomasp85/tweenr')
```
## An example
Following is an example of using the pipeable `tween_state()` function with our
belowed iris data:
```{r, fig.show='animate', interval=1/10, message=FALSE, cache=TRUE}
library(tweenr)
library(ggplot2)
# Prepare the data with some extra columns
iris$col <- c('firebrick', 'forestgreen', 'steelblue')[as.integer(iris$Species)]
iris$size <- 4
iris$alpha <- 1
iris <- split(iris, iris$Species)
# Here comes tweenr
iris_tween <- iris$setosa %>%
tween_state(iris$versicolor, ease = 'cubic-in-out', nframes = 30) %>%
keep_state(10) %>%
tween_state(iris$virginica, ease = 'elastic-out', nframes = 30) %>%
keep_state(10) %>%
tween_state(iris$setosa, ease = 'quadratic-in', nframes = 30) %>%
keep_state(10)
# Animate it to show the effect
p_base <- ggplot() +
geom_point(aes(x = Petal.Length, y = Petal.Width, alpha = alpha, colour = col,
size = size)) +
scale_colour_identity() +
scale_alpha_identity() +
scale_size_identity() +
coord_cartesian(xlim = range(iris_tween$Petal.Length),
ylim = range(iris_tween$Petal.Width))
iris_tween <- split(iris_tween, iris_tween$.frame)
for (d in iris_tween) {
p <- p_base %+% d
plot(p)
}
```
## Other functions
Besides the `tween_state()`/`keep_state()` combo showcased above, there are a
slew of other functions meant for data in different formats
**`tween_components`** takes a single data.frame, a vector of ids identifying
recurrent elements, and a vector of timepoints for each row and interpolate each
element between its specified time points.
**`tween_events`** takes a single data.frame where each row encodes a single
unique event, along with a start, and end time and expands the data across a
given number of frames.
**`tween_along`** takes a single data.frame along with an id and timepoint
vector and calculate evenly spaced intermediary values with the possibility of
keeping old values at each frame.
**`tween_at`** takes two data.frames or vectors along with a numeric vector
giving the interpolation point between the two data.frames to calculate.
**`tween_fill`** fills missing values in a vector or data.frame by interpolating
between previous and next non-missing elements
## Easing
In order to get smooth transitions you'd often want a non-linear interpolation.
This can be achieved by using an easing function to translate the equidistant
interpolation points into new ones. `tweenr` has support for a wide range of
different easing functions, all of which can be previewed using `display_ease()`
as here where the popular *cubic-in-out* is shown:
```{r, dev='png'}
tweenr::display_ease('cubic-in-out')
```
## Spatial interpolations
The purpose of `tweenr` is to interpolate values independently. If paths and
polygons needs to be transitioned the
[`transformr`](https://github.com/thomasp85/transformr) package should be used
as it expands tweenr into the spatial realm
```{r, echo=FALSE}
path <- dirname(knitr::fig_path())
animations <- list.files(path, pattern = 'README-.*.gif')
for (file in animations) {
files <- list.files(path, pattern = paste0(sub('.gif', '', file), '.*jpeg'), full.names = TRUE)
unlink(files)
}
```
Owner
- Name: Thomas Lin Pedersen
- Login: thomasp85
- Kind: user
- Location: Copenhagen
- Company: @posit-pbc, part of @tidyverse team
- Website: www.data-imaginist.com
- Twitter: thomasp85
- Repositories: 121
- Profile: https://github.com/thomasp85
Maker of tools focusing on data science and data visualisation
GitHub Events
Total
- Watch event: 2
- Pull request event: 1
- Fork event: 1
Last Year
- Watch event: 2
- Pull request event: 1
- Fork event: 1
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Thomas Lin Pedersen | t****5@g****m | 137 |
| Elliott Sales de Andrade | q****t@g****m | 2 |
| Romain François | r****n@r****m | 1 |
| Matthew Law | m****w@g****m | 1 |
| Luciano Selzer | l****r@g****m | 1 |
| Laurent Gatto | l****0@c****k | 1 |
| Jonathan Polonsky | j****y@g****m | 1 |
| Jon Harmon | j****k@g****m | 1 |
| Jim Hester | j****r@g****m | 1 |
| Hadley Wickham | h****m@g****m | 1 |
| Anas sheashaey | s****5@g****m | 1 |
Committer Domains (Top 20 + Academic)
cam.ac.uk: 1
rstudio.com: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 45
- Total pull requests: 15
- Average time to close issues: 5 months
- Average time to close pull requests: 5 months
- Total issue authors: 26
- Total pull request authors: 14
- Average comments per issue: 1.42
- Average comments per pull request: 0.8
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- thomasp85 (19)
- skanskan (2)
- davidjrea (1)
- sjmgarnier (1)
- JB70 (1)
- jeroen (1)
- karimn (1)
- lselzer (1)
- DarwinAwardWinner (1)
- ottlngr (1)
- yazun (1)
- padpadpadpad (1)
- Torvaney (1)
- hadley (1)
- dgrtwo (1)
Pull Request Authors
- QuLogic (2)
- katrinabrock (2)
- olivroy (2)
- she3o (1)
- romainfrancois (1)
- jonthegeek (1)
- jimhester (1)
- jpolonsky (1)
- hadley (1)
- tjconstant (1)
- lselzer (1)
- matthew-law (1)
- Torvaney (1)
- lgatto (1)
Top Labels
Issue Labels
enhancement (1)
bug (1)
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cran 92,058 last-month
- Total docker downloads: 104,329
-
Total dependent packages: 7
(may contain duplicates) -
Total dependent repositories: 31
(may contain duplicates) - Total versions: 23
- Total maintainers: 1
proxy.golang.org: github.com/thomasp85/tweenr
- Documentation: https://pkg.go.dev/github.com/thomasp85/tweenr#section-documentation
- License: other
-
Latest release: v2.0.3+incompatible
published almost 2 years ago
Rankings
Dependent packages count: 5.4%
Average: 5.5%
Dependent repos count: 5.7%
Last synced:
6 months ago
cran.r-project.org: tweenr
Interpolate Data for Smooth Animations
- Homepage: https://github.com/thomasp85/tweenr
- Documentation: http://cran.r-project.org/web/packages/tweenr/tweenr.pdf
- License: MIT + file LICENSE
-
Latest release: 2.0.3
published almost 2 years ago
Rankings
Stargazers count: 1.0%
Downloads: 1.6%
Forks count: 1.7%
Average: 6.1%
Dependent repos count: 6.2%
Dependent packages count: 9.1%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
6 months ago
conda-forge.org: r-tweenr
- Homepage: https://github.com/thomasp85/tweenr
- License: MIT
-
Latest release: 2.0.2
published over 3 years ago
Rankings
Dependent repos count: 10.7%
Dependent packages count: 15.6%
Average: 18.3%
Stargazers count: 19.7%
Forks count: 27.4%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.2.0 depends
- farver * imports
- magrittr * imports
- rlang * imports
- vctrs * imports
- covr * suggests
- testthat * suggests