Skip to content

Instantly share code, notes, and snippets.

View juanchiem's full-sized avatar
😳

Juan Edwards Molina juanchiem

😳
View GitHub Profile
# remotes::install_github("ropensci/gistr")
pacman::p_load(tidyverse, gistr)
options(github.username = 'juanchiem')
gists('mineall')
gist("3690306a2f7d7b36ac251fd55cf05e09") %>% gist_save() %>% gist_open()
# Get country centroids---
pacman::p_load(rgeos, rworldmap)
# get world map
wmap <- getMap(resolution="low")
# Single station (Balcarce) - multiple seasons
years <- 2020:2021
seasons <- paste0(years, "-06-30")
station <- c(121.255669, 14.16742)
seasons_wth <-
map(
.x = seasons,
.f = get_wth,
@juanchiem
juanchiem / get_genotypes.R
Last active April 10, 2022 13:14 — forked from agustin-alesso/get_genotypes.R
find genotypes that are repeatead in selected environments
pacman::p_load(tidyverse)
# Fake data
full_grid <- expand_grid(
gen = paste0("G", 1:3),
loc = paste0("L", 1:3),
season = paste0("S", 1:4)
) %>%
mutate(env = paste(loc, season))
replications(~ gen * env, full_grid)
```{r}
pacman::p_load(tidyverse)
```
```{r, eval=FALSE}
dataURL <- "http://coopnecochea.com/web/download/lluvias/Lluvias-2021.xls"
download.file(dataURL, destfile=data)
```
@juanchiem
juanchiem / github.R
Last active March 12, 2022 00:19 — forked from z3tt/github.R
Configure GitHub for Rstudio
#### 1. Sign up at GitHub.com ################################################
## If you do not have a GitHub account, sign up here:
## https://github.com/join
# ----------------------------------------------------------------------------
#### 2. Install git ##########################################################
## If you do not have git installed, please do so:
dat <- data.frame(
stringsAsFactors = FALSE,
trt = c(2,2,2,2,2,2,2,10,10,10,
10,10,10,10,2,2,2,2,2,2,2,10,10,10,10,10,
10,10,2,2,2,2,2,2,2,10,10,10,10,10,10,10),
par = c("2_1","2_1","2_1","2_1",
"2_1","2_1","2_1","10_1","10_1","10_1","10_1","10_1",
"10_1","10_1","2_2","2_2","2_2","2_2","2_2","2_2",
"2_2","10_2","10_2","10_2","10_2","10_2","10_2",
"10_2","2_3","2_3","2_3","2_3","2_3","2_3","2_3",
library(tidyverse)
# Establezcamos el periodo critico
plot_base <- ggplot(data = data.frame(t = 0), aes(x = t))+
annotate("rect", xmin = 15, xmax = 40,
ymin = 0, ymax = 100,
alpha = .2)+
labs(y="Incidencia %")+
xlim(0,40) +
library(quantreg)
library(dplyr)
library(lubridate)
library(stringr)
library(readr)
library(ggplot2)
library(devtools)
library(splines)
gg<-expand.grid(type=letters[1:4], year=2000:2004)
df<-data.frame(gg, emissions=runif(nrow(gg)*10))
df %>%
ggplot() +
aes(x=year, y=emissions)+
geom_line(stat = "summary", linetype= "dashed", fun=mean)+
geom_line(stat = "summary", fun=mean, aes(col=type))
library(tidyverse)
library(scholar)
# get from scholar profile urlafter "/citations?user=" and before "=en"
id_authorname <- "TQQzkCwAAAAJ&hl"
profile_authorname <- get_profile(id_authorname)
profile_authorname
library(googlesheets4)