Skip to content

Instantly share code, notes, and snippets.

View jclopeztavera's full-sized avatar
🎯
Focusing

Juan Carlos López Tavera jclopeztavera

🎯
Focusing
View GitHub Profile
#' ---
#' title: "parse_curp"
#' author: "Juan C. López Tavera"
#' date: "10/6/2017"
#' output:
#' html_document:
#' keep_md: yes
#' pdf_document: default
#' ---
#'
transform <- function(x, target.mean = 500, target.sd = 100) {
y <- target.mean + (x - mean(x)) * (target.sd/sd(x))
return(y)
}

RePISA Individual Contributor License Agreement

Thank you for your interest in contributing to the open source software project (“Project”) made available by the author, Juan C. López Tavera, or its affiliates (“Author”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to the Author in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact jc.lopeztavera@gmail.com.

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.

Copyright License. You hereby grant, and agree to grant, to the

@jclopeztavera
jclopeztavera / mapeando_sismo.R
Last active May 25, 2020 19:29
Mexico's 2019 earthquake data processing and mapping
## Cargando los paquetes necesarios para el análisis
if (!require(tidyverse)) {
install.packages(tidyverse)
}
library(tidyverse)
if (!require(googledrive)) {
install.packages("googledrive")
}
library(googledrive)

Keybase proof

I hereby claim:

  • I am jclopeztavera on github.
  • I am jclopeztavera (https://keybase.io/jclopeztavera) on keybase.
  • I have a public key ASC0eMopnUAJneJrO7br9v0vOQPnWs2xjgMVcujKSCyssAo

To claim this, I am signing this object:

@jclopeztavera
jclopeztavera / is_normal.R
Last active March 8, 2017 07:19
Function to test for normality of numeric variables in a dataframe
## Function to test for normality of numeric variables in a dataframe
is.normal <- function(x) {
z <- lapply(x[sapply(x, is.numeric)], shapiro.test)
lz <- length(z)
y <- logical(length = lz)
for (i in 1:lz) {
if (z[[i]]$p.value >= 0.1) {
y[i] <- TRUE
} else {
y[i] <- FALSE
@jclopeztavera
jclopeztavera / loade.R
Last active June 18, 2017 17:55
Function to install and load R packages in one step
loader <- function(...) {
x <- list(...)
p <- x[sapply(X = x, FUN = is.character)]
for (i in 1:length(p)) {
if (!p[[i]] %in% installed.packages()) {
install.packages(p[[i]])
}
if (!require(p[[i]], character.only = TRUE)) {
library(p[[i]], character.only = TRUE)
}