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(Rvision) | |
X <- 1920 | |
Y <- 1080 | |
corners_screen <- matrix(c(0, Y, | |
X, Y, | |
X, 0, | |
0, 0), | |
ncol = 2, byrow = TRUE) |
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(ggplot2) | |
library(dplyr) | |
library(extrafont) | |
# | |
# extrafont::font_import("~/Downloads/") | |
CHANEWEI <- "Chalet-NewYorkNineteenEighty" | |
# Download data | |
url <- "https://apitransporte.buenosaires.gob.ar/ecobici/gbfs/stationInformation" |
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(metR) | |
library(data.table) | |
library(ggplot2) | |
proj <- "+proj=lcc +lon_0=-60 +lat_1=-0 +lat_2=-40" | |
topo <- GetTopography(ConvertLongitude(-85), | |
330, lat.north = 14, lat.south = -58, | |
resolution = 2/60) |> |
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(ggplot2) | |
library(units) | |
library(sf) | |
world <- rnaturalearth::ne_countries(returnclass = "sf", scale = 10) |> | |
st_transform(crs = "+proj=moll") | |
# Make a hexagonal grid | |
size <- 1000000 |
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
total <- 116653684*1024 # change your total dir size here | |
folder_size <- function() { | |
system('du -s "[folder]"', intern = TRUE) %>% # change your dest folder here | |
strsplit(split = "\t", fixed = TRUE) %>% | |
.[[1]] %>% | |
.[1] %>% | |
as.numeric() | |
} |
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
# This is now available into ggpercentogram. | |
# https://github.com/eliocamp/ggpercentogram/ | |
StatQuantileBin <- ggplot2::ggproto("StatQuantileBin", ggplot2::StatBin, | |
default_aes = ggplot2::aes(x = ggplot2::after_stat(density), y = ggplot2::after_stat(density), weight = 1), | |
compute_group = function(data, scales, | |
binwidth = NULL, bins = 30, breaks = NULL, trim = 0, | |
closed = c("right", "left"), pad = FALSE, | |
flipped_aes = FALSE, | |
# The following arguments are not used, but must | |
# be listed so parameters are computed correctly |
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
#' Smooths a 2D field | |
#' | |
#' @param x,y Vector of x and y coordinates | |
#' @param value Vector of values | |
#' @param kx,ky Proportion of components to keep in the x and | |
#' y direction respectively. Lower values increased the smoothness. | |
#' | |
#' @examples | |
#' library(ggplot2) | |
#' # Creates a noisy version of the volcano dataset and applies the smooth |
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
# Define the directory where to save the plot data | |
knitr::opts_chunk$set(plot_data_dir = "plot-data2") | |
save_plot_data <- function(plot, label = "plot", dir = NULL) { | |
# If the user didn't set up a dir explicitly, don't do anything | |
if (is.null(dir)) { | |
return(invisible(NULL)) | |
} | |
if (!dir.exists(dir)) { |
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(magrittr) | |
library(ggplot2) | |
library(rgl) | |
library(plotly) | |
set.seed(42) | |
# Cantidad de puntos por grupos | |
N <- 20 | |
# Localización de los grupos |
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
ditto <- function(expr) { | |
plus_fun <- function(e1, e2) { | |
if (is.list(e1)) { | |
c(e1, list(e2)) | |
} else { | |
list(e1, e2) | |
} | |
} |
NewerOlder