I hereby claim:
- I am krlmlr on github.
- I am krlmlr (https://keybase.io/krlmlr) on keybase.
- I have a public key ASBWEsk3aAEpYhxYHUb4WzW1oPyWabWULdGBQ1_ci84Hiwo
To claim this, I am signing this object:
| # Use: add `log_call("<function name")` to your functions | |
| # TODO: Add to all functions in a namespace via `trace()` | |
| indent <- new_environment(list(value = 0L)) | |
| log_call <- function(name, call = sys.call(-1), envir = parent.frame()) { | |
| srcref <- attr(call, "srcref") | |
| if (is.null(srcref)) { | |
| call_dep <- paste(gsub("^ +", "", deparse(call)), collapse = "") |
| library(conflicted) | |
| library(tidyverse) | |
| new_region <- function(name) { | |
| paste0("# ", name, " ", strrep("-", max(88 - nchar(name) - 4, 0))) | |
| } | |
| boilerplate <- function(name) { | |
| paste(collapse = "\n", c( | |
| new_region(name), |
| generate <- function(named, unnamed, used = exprs()) { | |
| if (length(named) == 0 && length(unnamed) == 0) { | |
| return(deparse(call2("check_api", !!!used), width.cutoff = 500)) | |
| } | |
| out <- character() | |
| for (i in seq_along(named)) { | |
| out <- c(out, generate(named[-i], unnamed, c(used, named[i]))) | |
| } |
| # Connect to your database here | |
| con <- DBI::dbConnect(duckdb::duckdb()) | |
| # I'd be especially interested in getting a dump of this data! | |
| columns <- DBI::dbGetQuery(con, "SELECT * FROM information_schema.columns WHERE LOWER(table_schema) = 'information_schema'") | |
| columns | |
| write.csv(columns, "columns.csv", na = "") |
| library(dm) | |
| # Connect to your database here | |
| con <- DBI::dbConnect(duckdb::duckdb()) | |
| meta <- dm:::dm_meta(con, simple = TRUE) | |
| # Does this work? | |
| meta %>% | |
| dm_ptype() |
| penguins_dt <- data.table::as.data.table(palmerpenguins::penguins[1:3,]) | |
| penguins_dt | |
| print_data_table <- function(x, ...) { | |
| # Adapted from data.table:::as.data.frame.data.table() | |
| ans <- x | |
| attr(ans, "row.names") <- .set_row_names(nrow(x)) | |
| attr(ans, "class") <- c("tbl", "data.frame") | |
| attr(ans, "sorted") <- NULL | |
| attr(ans, ".internal.selfref") <- NULL |
I hereby claim:
To claim this, I am signing this object:
| `<-` <- function(lhs, rhs, envir = parent.frame()) { | |
| assign(as.character(substitute(lhs)), rhs, envir) | |
| lockBinding(substitute(lhs), envir) | |
| invisible(rhs) | |
| } |
| #' --- | |
| #' title: Mismatch between source and test files in tibble | |
| #' output: | |
| #' html_notebook: | |
| #' toc: true | |
| #' code_folding: hide | |
| #' --- | |
| # For paged output | |
| options(max.print = 1000) |
| library(RSQLite) | |
| conn <- dbConnect(SQLite()) | |
| dbExecute(conn, " | |
| CREATE TABLE IF NOT EXISTS `sim` ( | |
| `time` TEXT, | |
| `subject` INTEGER, | |
| `encounter` INTEGER, | |
| `location` INTEGER, | |
| `temp` REAL, |