Skip to content

Instantly share code, notes, and snippets.

library(httr)
library(jsonlite)
library(rfeb)
# Función para obtener los resultados de los partidos que aparecen en Baloncesto en Vivo en este momento
# competition puede ser: "Liga LEB Oro", "Liga Dia", "Liga LEB Plata", "L.F.-2", "EBA"
get_round_results <- function(competition = "Liga LEB Oro") {
api <- GET("http://baloncestoenvivo.feb.es/api/OverView/")
data_json <- content(api, as = "text", encoding = "UTF-8")
data <- fromJSON(data_json)
library(tidyverse)
pbp2018 <- read_csv("pbp2018.csv")
pbp2018 %>%
group_by(player_name) %>%
summarise(
# Partidos disputados
games = length(unique(game_code)),
# Tiros de 2 anotados
# Elo Rating System
library(eurolig)
library(tidyverse)
library(lubridate)
load("data/results.rds")
# Helpers -----------------------------------------------------------------
## Scorekeeper bias in LEB Oro
library(tidyverse)
data_file <- "https://github.com/solmos/feb-data/raw/master/assists-leb-oro.csv"
assists_leb_oro <- read_csv(data_file)
# Players -----------------------------------------------------------------
ast_player <- assists_leb_oro %>%
readFireCounts <- function(file) {
fire_counts <- read_delim(file, delim = ";") %>%
rename(date = "ACQ_DATE") %>%
count(date) %>%
as_tibble()
dates_expanded <- seq(min(fire_counts$date), max(fire_counts$date), by = "days")
fires_full <- tibble(date = dates_expanded) %>%
left_join(fire_counts) %>%
mutate(
day = day(date),
@solmos
solmos / readNc.R
Last active September 17, 2020 16:02
library(tidyverse)
library(tidync)
readNcFiles <- function(files, lat_range = c(8, 37), lon_range = c(68, 98)) {
nc_list <- map(files, tidync)
names(nc_list) <- files
filterNc <- function(nc, lat_range = c(8, 37), lon_range = c(68, 98)) {
nc %>%
hyper_filter(LAT = between(LAT, lat_range[1], lat_range[2]),
library(dplyr)
## Create similar but simpler data frame to yours
df <- data.frame(
scenario = rep(1:3, 2),
year = rep(2010:2011, each = 3),
age_25_29 = rnorm(6),
age_30_34 = rnorm(6),
age_35_39 = rnorm(6)
)
library(splines)
library(dplyr)
library(readr)
library(tidyr)
library(ggplot2)
## Use your path
df <- read_csv("data.csv") %>%
select(fever, mean.anom.4w, water.safe)
git clone --depth=1 --single-branch
--branch emacs-27 https://github.com/emacs-mirror/emacs.git
cd emacs/
sudo apt install -y autoconf make gcc texinfo libgtk-3-dev libxpm-dev \
libjpeg-dev libgif-dev libtiff5-dev libgnutls28-dev libncurses5-dev \
libjansson-dev libharfbuzz-dev libharfbuzz-bin
./autogen.sh
library(tidyverse)
## Simple example dataset
time_on_study <- tibble(
id = 1:5,
start_followup = 0,
time_followup = c(2, 4, 3, 1, 3),
age_baseline = c(18, 30, 28, 20, 18),
event = factor(c(1, 0, 1, 1, 0), labels = c("Censored", "Event"))
)