- 0 = red
- 1 = green
The three 'players' are Pa, Pb, and Pc.
Before any blindfolds are removed, and even before any dots are painted, we have the complete set of possibilities as:
| x <- iris | |
| present_names <- c("Sepal.Width", "Sepal.Length") | |
| microbenchmark::microbenchmark( | |
| dplyr::select(x, present_names), | |
| dplyr::select(x, dplyr::all_of(present_names)), | |
| x[present_names], | |
| x[,present_names] | |
| ) |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <libpq-fe.h> | |
| static void error_exit(PGconn *conn) { | |
| PQfinish(conn); | |
| exit(1); | |
| } | |
| int main(int argc, char **argv) { |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <libpq-fe.h> | |
| static void error_exit(PGconn *conn) { | |
| PQfinish(conn); | |
| exit(1); | |
| } | |
| int main(int argc, char **argv) { |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <libpq-fe.h> | |
| static void error_exit(PGconn *conn) { | |
| PQfinish(conn); | |
| exit(1); | |
| } | |
| int main(int argc, char **argv) { |
| Put test.js in www/ directory for the Shiny app. | |
| Look at console output for different input values. | |
| When input value is 0, the returned value is an object (empty array). | |
| When input value is 1, the returned value is a string. | |
| When input value is >1, the returned value is back to being an object (a populated array). | |
| This forces parsing of returned values that may vary in the length to include conditional logic, which is unneeded complexity. | |
| Proposal: the returned JSON value should conform to jsonlite's default behavior. |
| ## create a boatload of non-trivial functions | |
| my_functions <- lapply(runif(1e6), function(i) function(x) x^i) | |
| system.time(lapply(my_functions, function(f) f(2))) | |
| ## output: | |
| ## user system elapsed | |
| ## 1.370 0.023 1.398 | |
| x <- list(2) | |
| system.time(lapply(my_functions, do.call, x)) |