Skip to content

Instantly share code, notes, and snippets.

View Athospd's full-sized avatar
🏠
Working from home

Athos Petri Damiani Athospd

🏠
Working from home
View GitHub Profile
@Athospd
Athospd / one vs two individual models
Created April 5, 2025 17:22
Comparison between 1 single model against two individual models for a given set of scenarios
# Load necessary libraries
library(tidymodels)
library(bonsai)
library(tidyverse)
library(ggplot2)
library(patchwork)
f <- glue::glue
theme_set(theme_minimal())
logit <- function(x) 1/(1 + exp(-x))
@jjesusfilho
jjesusfilho / pg_pivot_wider.R
Last active January 18, 2024 11:28
Converts PostgreSQL table from long to wide format from R
#' Converts PostgreSQL table from long to wide format
#'
#' @param conn Connection
#' @param tbl Table
#' @param new_tbl Optional. It creates a new table in the database
#' instead of importing it to R
#' @param id_cols String vector with the name of columns to be used as identities
#' @param names_from Column whose values will become variables
#' @param values_from Column whose values will populate the new variables
#'