This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
da <- read.csv("https://raw.githubusercontent.com/juanchiem/agro_data/master/spores.csv", | |
sep = ";") | |
da %>% | |
group_by(meter, spore_nuclei, .drop=FALSE) %>% | |
summarise(count = mean(count)) %>% | |
mutate(percent = count/sum(count)) %>% | |
# group_by(meter, spore_nuclei) %>% | |
# mutate(tot = sum(count)) | |
ggplot(aes(x=meter, y=percent, fill=factor(spore_nuclei) ))+ | |
geom_bar(position="fill", stat="identity")+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
wide <- read.csv("https://raw.githubusercontent.com/juanchiem/agro_data/master/multiple_dis_metric.csv", | |
sep = ",") %>% as.tibble() | |
wide | |
wide %>% | |
pivot_longer( | |
cols = contains("_"), | |
names_to="var", | |
values_to='val') %>% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df <- tibble::tribble( | |
~zona, ~campana, | |
"Madariaga - Maipu - Ramos Otero", "18-19", | |
"Balcarce - Loberia - La Brava", "18-19", | |
"Balcarce - Loberia - La Brava", "20-21", | |
"MdP - Miramar - Otamendi", "19-20", | |
"Madariaga - Maipu - Ramos Otero", "19-20", | |
"Madariaga - Maipu - Ramos Otero", "19-20", | |
"Madariaga - Maipu - Ramos Otero", "20-21", | |
"MdP - Miramar - Otamendi", "18-19", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
theme_set(cowplot::theme_minimal_grid()+ | |
theme(legend.position = "bottom", | |
legend.justification = "center", | |
legend.title.align = 0.5, | |
legend.title = element_text(size = 10, face = "bold"), | |
legend.text = element_text(size = 10), | |
axis.text.x = element_text(size = 6), | |
axis.text.y = element_text(size = 6), | |
axis.title.x = element_text(size=12, face = "bold"), | |
axis.title.y = element_text(size=12, face = "bold"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
theme_set(theme_bw()+ | |
theme( | |
panel.grid.major = element_line(color = gray(0.5), | |
linetype = "dashed", | |
size = 0.1), | |
panel.background = element_rect(fill = "aliceblue"), | |
axis.text.x = element_text(size = 6), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(tidyverse, googlesheets4) | |
gs4_auth(email = "[email protected]") | |
gs4_find("my_sheet") | |
#copiar id y establecer acceso | |
my_sheet <- gs4_get("1b3Zu9CT-B1lHVwkl7wLS_njDQyvwRFYnw_H-OjyO7LA") | |
#intervalo que deseo los datos | |
dates <- seq.Date(lubridate::dmy("1-8-2020"), | |
lubridate::dmy("20-3-2021"), by = "1 day") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
starwars %>% | |
mutate(across(c("name", "sex"), | |
~stringi::stri_trans_general( | |
#pasar a mayusculas y sacar puntos | |
str_to_upper(gsub(',', '\\.', | |
# sacar espacios antes-desp | |
str_trim( | |
str_replace_all(., fixed(" "), "_") | |
))), "Latin-ASCII"))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(zoo) | |
library(lubridate) | |
library(ggplot2) | |
set.seed(49) | |
dat1 = data.frame(date = seq(as.Date("2015-01-15"), as.Date("2015-12-15"), "1 month"), | |
value = cumsum(rnorm(12))) | |
dat1$date = as.yearmon(dat1$date) | |
dat2 = data.frame(date = seq(as.Date("2016-01-15"), as.Date("2016-12-15"), "1 month"), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat %>% | |
filter(str_detect(cultivo_de_cosecha, 'Tr|Ceb')) %>% | |
select(campana,Zona, cultivo_de_cosecha, variedad,rinde ) %>% | |
group_by(cultivo_de_cosecha, Zona, variedad) %>% | |
filter(n() > 5) %>% ungroup %>% | |
mutate_if(is.character, as.factor) ->dat1 | |
dat1%>% | |
count(cultivo_de_cosecha, Zona, variedad) %>% | |
arrange(cultivo_de_cosecha, desc(n)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pacman::p_load(tidyverse, googlesheets4) | |
# Planilla que tiene 2 filas de encabezados (fila 2 y 3), y debemos fusionar. | |
# La primer fila es una inclusión extra para faciltar el proceso. | |
u <- "https://docs.google.com/spreadsheets/d/1zf0UqTNiYl7z241Fkr1LtP52D3G9nIzzjyl3zbM8eaU/edit?usp=sharing" | |
planilla <- gs4_get(u) | |
# leemos las filas con info para los nombres de las columnas | |
data_head <- planilla %>% read_sheet(n_max = 2) |