courtiol / lay Goto Github PK
View Code? Open in Web Editor NEWAn R package for a simple and efficient implementation of rowwise jobs
Home Page: https://courtiol.github.io/lay/
License: Other
An R package for a simple and efficient implementation of rowwise jobs
Home Page: https://courtiol.github.io/lay/
License: Other
I am not sure why but slider (and only slider) shows very different speed whenever run in README vs in the vignette showing the benchmarks:
@DavisVaughan, any idea why? I only discovered your great package right now and did not dig, but this is quite intriguing... Is it a compilation issue?
It does not make much sense to do means and medians of different sepal dimensions.
We need a better example.
Use marketting data with multiple Q_r_ questions?
It would be great if lay()
could allow the passing of arguments.
I cannot get it work with a pmap()
(hence no PR; forwarding the lay-level ...
seems more tricky than I thought) but here is an apply()
-based example:
library(dplyr, warn.conflicts = FALSE)
lay <- function(x, fun, ...) {
fn <- rlang::as_function(fun)
bits <- apply(x, 1, fn, ...)
vctrs::vec_c(!!!bits)
}
iris <- as_tibble(iris)
iris_na <- iris
iris_na[1, 1] <- NA
iris_na %>%
mutate(sepal = lay(across(starts_with("Sepal")), median)) %>%
slice_head(n = 2)
#> # A tibble: 2 x 6
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species sepal
#> <dbl> <dbl> <dbl> <dbl> <fct> <dbl>
#> 1 NA 3.5 1.4 0.2 setosa NA
#> 2 4.9 3 1.4 0.2 setosa 3.95
iris_na %>%
mutate(sepal = lay(across(starts_with("Sepal")), median, na.rm = TRUE)) %>%
slice_head(n = 2)
#> # A tibble: 2 x 6
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species sepal
#> <dbl> <dbl> <dbl> <dbl> <fct> <dbl>
#> 1 NA 3.5 1.4 0.2 setosa 3.5
#> 2 4.9 3 1.4 0.2 setosa 3.95
We need to design a nice hexsticker... perhaps a hammock with a tibble sleeping in it?
"Benchmarks" and "Benchmark on smaller dataset" are not consistent...
I need to break down the examples in the README for visual purposes.
I need benchmark to compare the performances of multiple rowwise alternatives.
Users unfamiliar with lay may call rowwise()
beforehand.
Doing so should exert no effect besides slowing down computation massively.
So perhaps we should detect rowwise groupings and act upon ithat (remove temporarily, warn, err, ...?).
That would probably imply to detect if the object is a tibble.
We need to see how this is efficiently done in dplyr.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.