I hereby claim:
- I am jlehtoma on github.
- I am jlehtoma (https://keybase.io/jlehtoma) on keybase.
- I have a public key whose fingerprint is CCCE BB9B C821 8250 74F4 28BA B49C 7E97 E9C2 A513
To claim this, I am signing this object:
library(rlist) | |
x <- list(list("ID"=1, "var1"="B", "var2"="D"), | |
list("ID"=2, "var1"="F", "var2"="H"), | |
list("ID"=3, "var1"="I", "var2"=NULL)) | |
# rlist approach - returns FALSE | |
list.any(x, l ~ is.null(l)) | |
# 2-level lapply - returns TRUE |
I hereby claim:
To claim this, I am signing this object:
# Based on solution given here: http://geospatialpython.com/2011/11/generating-shapefile-shx-files.html | |
# Depends on pyshp | |
# Build a new shx index file | |
import fnmatch | |
import os | |
import shapefile | |
# List all the shapefiles | |
def find(pattern, path): |
# Tell all slaves to return a message identifying themselves. | |
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size())) | |
mpi.remote.exec(paste(mpi.comm.get.parent())) | |
# Send execution commands to the slaves | |
x <- 5 | |
x <- mpi.remote.exec(rnorm, x) | |
x | |
mpi.close.Rslaves() |
library(dplyr) | |
library(magrittr) | |
museum_transects <- read.table("data/museon_linjat.csv", as.is = TRUE, | |
sep = ";", header = TRUE) | |
standard_transects <- read.table("data/vakioreitit_lista_suojelualueet.csv", | |
as.is = TRUE, sep = ";", header = TRUE) | |
# Select only columns Reitti and Suojelualue form standard_transects |
library(dplyr) | |
library(tidyr) | |
dat <- data.frame(laji=c("accgen", "accnis", "accgen", "accnis" , "accgen", | |
"accnis", "accgen", "accnis"), | |
lkm=c(2, 2, 1, 4, 3, 2, 2, 6), | |
linja_P_E = c("P", "P", "E", "E", "P", "P", "E", "E")) | |
dat_agg <- dat %>% | |
# Group by both laji and linja_P_E |
library("dplyr") | |
library("magrittr") | |
library("rvest") | |
urls <- c("http://koivu.luomus.fi/seurannat/linjalaskenta/vakiolinjat.php") | |
site <- html(urls) | |
linjat_table <- site %>% | |
html_node("table") %>% | |
html_nodes("tr") |
install.packages(c("maptools", "rworldmap", "rworldxtra")) | |
# Load required packages | |
library(maptools) | |
library(rworldmap) | |
# Define LAEA projection for Europe | |
crs.laea <- CRS("+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs") # Lambert Azimuthal Equal Area | |
# Grab the whole world, NOTE that you will also need package rworldextra |
# Tell all slaves to return a message identifying themselves. | |
mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size())) | |
mpi.remote.exec(paste(mpi.comm.get.parent())) | |
# Send execution commands to the slaves | |
x <- 5 | |
x <- mpi.remote.exec(rnorm,x) | |
length(x) | |
x |
library(rworldmap) | |
library(rgdal) | |
# Latlon | |
world_map_wgs84 <- getMap() | |
plot(world_map_wgs84, main = "WGS84") | |
proj4string(world_map_wgs84) | |
# Mollweide | |
world_map_mollweide <- spTransform(world_map_wgs84, CRS("+proj=moll")) |