Skip to content

Instantly share code, notes, and snippets.

View Arrendi's full-sized avatar

Antonio M. Hegar PhD Arrendi

View GitHub Profile
@Arrendi
Arrendi / ukMap.R
Created November 17, 2023 15:12 — forked from danthemango/ukMap.R
British Generic Place Name Mapper
# generic place name maps in great britain (not northern ireland, my dataset didn't include it)
# I used the place name data from https://www.ordnancesurvey.co.uk
# it doesn't include latitude or longitude, rather "geometry_x", "geometry_y" values which correspond
# to the british ordinance survey national grid
# where 'geometry_x' is the number of metres east of the southwest corner of the grid
# and 'geometry_y' is the number of metres north of the southwest corner of the grid
# I am using the sgo library to convert BNG to WGS84
# (note: WGS84 is the standard, google maps location format)
@Arrendi
Arrendi / index.html
Created March 18, 2023 13:17 — forked from awoodruff/index.html
Leaflet map with two tile layers
<html>
<head>
<title>A Leaflet map!</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css"/>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<style>
#map{ height: 100% }
</style>
</head>
<body>
@Arrendi
Arrendi / mice_imp.R
Created February 14, 2022 10:36 — forked from mick001/mice_imp.R
Imputing missing data with R; MICE package: Full article at http://datascienceplus.com/imputing-missing-data-with-r-mice-package/
# Using airquality dataset
data <- airquality
data[4:10,3] <- rep(NA,7)
data[1:5,4] <- NA
# Removing categorical variables
data <- airquality[-c(5,6)]
summary(data)
#-------------------------------------------------------------------------------
---
title: "Making Interactive Maps of Public Data in R"
author: "Ryan Rosenberg"
output: html_document
---
<style>
.leaflet {
margin: auto;
}
</style>
@Arrendi
Arrendi / data.table-joins.R
Created July 23, 2020 15:45 — forked from nacnudus/data.table-joins.R
How to do joins with data.table
library(data.table)
?`[.data.table`
DT <- data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
X <- data.table(x=c("c","b"), v=8:7, foo=c(4,2))
colnames(DT)
# [1] "x" "y" "v"
@Arrendi
Arrendi / restore_packages.R
Created January 31, 2020 19:06 — forked from arne-cl/restore_packages.R
save/load/install a list of your currently installed R packages
# restore_packages.R
#
# installs each package from the stored list of packages
# source: http://hlplab.wordpress.com/2012/06/01/transferring-installed-packages-between-different-installations-of-r/
load("~/installed_packages.rda")
for (count in 1:length(installedpackages)) {
install.packages(installedpackages[count])
}
@Arrendi
Arrendi / copyInstalledPackages.r
Created November 9, 2017 20:32 — forked from florianhartig/copyInstalledPackages.r
Script to copy the packages installed on one computer or R version to another. Originally from http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows
# run on old computer / r version
setwd("C:/Temp/") # or any other existing temp directory
setwd("/Users/Florian/Dropbox/temp")
packages <- installed.packages()[,"Package"]
save(packages, file="Rpackages")
# run on new computer / r version
setwd("C:/Temp/") # or any other existing temp directory
load("Rpackages")