https://github.com/UchidaMizuki/partialised
Partialised Functions
https://github.com/UchidaMizuki/partialised
Last synced: 4 months ago
JSON representation
Partialised Functions
- Host: GitHub
- URL: https://github.com/UchidaMizuki/partialised
- Owner: UchidaMizuki
- License: other
- Created: 2022-04-30T04:30:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-14T15:30:54.000Z (11 months ago)
- Last Synced: 2024-06-13T12:03:44.295Z (10 months ago)
- Language: R
- Homepage:
- Size: 39.1 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - UchidaMizuki/partialised - Partialised Functions (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# partialised
[](https://CRAN.R-project.org/package=partialised)
partialised provides a 'partialised' class that extends the partialising
function of 'purrr' by making it easier to change the arguments. This is
similar to the function-like object in 'Julia'
().## Installation
You can install the development version of partialised from [GitHub](https://github.com/) with:
``` r
# the released version from CRAN:
install.packages("partialised")# the development version from GitHub:
# install.packages("devtools")
devtools::install_github("UchidaMizuki/partialised")
```## Example
This is a basic example which shows you how to solve a common problem:
```{r example}
library(partialised)dist <- function(x, y) {
sqrt(x ^ 2 + y ^ 2)
}pdist <- new_partialised(dist,
list(x = 3))
pdist
pdist(y = 4)arguments(pdist)
pdist$x
pdist$ypdist$x <- 6
pdist(y = 8)pdist$y <- 8
pdist()
```