Skip to content

Instantly share code, notes, and snippets.

View antagomir's full-sized avatar

Leo Lahti antagomir

View GitHub Profile
@antagomir
antagomir / HSY-example.R
Created February 11, 2012 13:53
Hakuesimerkki: HSY Vaestoruudukko
library(sorvi)
sp <- GetHSY("Vaestoruudukko") # Hae HSY:n Vaestoruudukko-data
df <- as.data.frame(sp) # Tutki aineiston sisaltoa
at <- c(seq(0, 2000, 250), Inf)
q <- PlotShape(sp, "ASUKKAITA", type = "oneway", at = at, ncol = length(at)) # Piirra kuva
@antagomir
antagomir / kuntajako.R
Created February 22, 2012 23:45
uusi kuntajako kehitelmää
library(sorvi)
library(rgeos)
library(rgdal)
library(maptools)
library(gpclib)
if (!gpclibPermit()) { gpclibPermit() }
# ----------------------------------------------
# Lue nykyiset kuntarajat Maanmittauslaitoksen aineistosta
@antagomir
antagomir / myplot
Created June 18, 2012 14:00
plotti
plot(c(1,2,3))
@antagomir
antagomir / motionchart-example.R
Created June 19, 2012 11:04
google motion chart example
# Plot a Motion Chart using googleVis package - a brief example
# Leo Lahti 2012
# Load the library
# Note: requires flash and internet connection
# use install.packages("googleVis") to install the library if needed
library(googleVis)
# Form a motion chart from 'Fruits' example data
# NOTE: the data set ('Fruits' in this example) must be given as data.frame
@antagomir
antagomir / pxr_fix.R
Created September 23, 2012 10:55 — forked from jlehtoma/pxr_crash.R
pxR crashes R with certain kinds of PX-Axis files
library(pxR)
#################################################################
#
# File: read.px.R
# Purpose: reads a PC-Axis file into R
#
# Created: 20110618
# Authors: fvf, cjgb, opl
#
@antagomir
antagomir / pyrocomparison.R
Created October 5, 2012 12:53
NMF/SUM/RPA Pyroseq comparison script
library(microbiome)
hitchip <- list()
for (method in c("nmf", "sum", "rpa")) {
tab <- read.profiling(level = "L1", method = method, data.dir = "./", log10 = TRUE)
colnames(tab) <- toupper(gsub("\\.", "", colnames(tab)))
hitchip[[method]] <- tab
}
@antagomir
antagomir / server.R
Last active December 14, 2015 09:09
Shiny helloworld test
library(shiny)
library(ggplot2)
shinyServer(function(input, output) {
dataset <- reactive(function() {
diamonds[sample(nrow(diamonds), input$sampleSize),]
})
output$plot <- reactivePlot(function() {
@antagomir
antagomir / index.html
Created November 20, 2013 11:03
Scatterplot
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://polychart.com/s/third_party/polychart2.standalone.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
@antagomir
antagomir / index.html
Created February 21, 2015 23:12
EdinburghPeak
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.oesmith.co.uk/morris-0.4.2.min.css'>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js' type='text/javascript'></script>
@antagomir
antagomir / index.html
Created March 20, 2015 22:07
Scatterplot
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.oesmith.co.uk/morris-0.4.2.min.css'>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js' type='text/javascript'></script>