Skip to content

Instantly share code, notes, and snippets.

View RCura's full-sized avatar

Robin Cura RCura

View GitHub Profile
@RCura
RCura / server.R
Last active November 11, 2015 13:09
tooltip examples
# This is the server logic for a Shiny web application.
# You can find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com
#
library(shiny)
shinyServer(function(input, output) {
@RCura
RCura / dist_graf_RC_mieux.R
Last active November 4, 2015 23:15
correction du script d'Hélène
#distance 846 tours
distTow<-dist(TowSpdf@coords,method="euclidean")
matdistTow<-as.matrix(distTow)
matdistTow[matdistTow==0]<-NA
min(matdistTow,na.rm=TRUE)/1000
max(matdistTow,na.rm=TRUE)/1000
mean(matdistTow,na.rm=TRUE)/1000
model closest_to
global {
int nb_agents_min <- 50;
int nb_agents_max <- 5000;
bool agent1_use_geom <- false;
bool agent2_use_geom <- false;
geometry agent1_geom <- circle(3);
geometry agent2_geom <- circle(5);
@RCura
RCura / closest_to.gaml
Created October 30, 2015 16:43
Wrong performances of the closest_to operator in Gama 1.7 (dev)
/**
* closest_to
* Author: Robin Cura
* Description:
*/
model closest_to
global {
@RCura
RCura / batch_error.gaml
Created September 24, 2015 12:47
Gama : batch mode errors
model si
// A simple infection spreading model
global {
int number_people <- 300; // The init number of people
int number_I <- 1 ; // The init number of infected
float infection_rate <- 0.1 ; // The infection rate
float infection_distance <- 5.0 ; // infection distance (in meters)
int immune_step <- 30 ; // number of steps before becoming immune after infection
int end_immunity_step <-50; // number of steps before not being immune anymore
@RCura
RCura / gama_issue_1268_fix.diff
Created August 27, 2015 16:39
Patch for Issue #1268 of Gama
diff --git a/msi.gama.application/gama1.7.Eclipse3_8_2.product b/msi.gama.application/gama1.7.Eclipse3_8_2.product
index b97e304..7649748 100644
--- a/msi.gama.application/gama1.7.Eclipse3_8_2.product
+++ b/msi.gama.application/gama1.7.Eclipse3_8_2.product
@@ -268,6 +268,10 @@ openFile
<feature id="org.eclipse.ecf.core.ssl.feature"/>
<feature id="org.eclipse.ecf.filetransfer.ssl.feature"/>
<feature id="org.eclipse.e4.rcp"/>
+ <feature id="ummisco.gama.feature.models"/>
+ <feature id="ummisco.gama.feature.dependencies"/>
voteNames <- paste("Vote", 1:9, sep="")
outputHRR <- rollcall(data = depVotes, yea = 1, nay = 6, missing = c(8,9), notInLegis = 0, legis.names = legisNames, vote.names = voteNames)
outputOC <- oc(rcObject = outputHRR, dims = 2, minvotes = 1, polarity = c(4,323))
@RCura
RCura / oc_output.txt
Last active August 29, 2015 14:18
OC bug
rank correctYea wrongYea wrongNay correctNay volume coord1D coord2D
Legis1 9.5 1 0 0 3 0.154 0.1393427 2.439471e-04
Legis2 9.5 1 0 0 3 0.213 0.1393427 2.439471e-04
Legis3 7.0 2 0 0 2 0.131 0.1392035 -9.211715e-25
Legis4 7.0 2 0 0 2 0.029 0.1392035 -9.211715e-25
Legis5 7.0 2 0 0 2 0.070 0.1392035 -9.211715e-25
Legis6 3.0 0 0 0 0 0.000 0.0000000 0.000000e+00
Legis7 3.0 0 0 0 0 0.000 0.0000000 0.000000e+00
Legis8 3.0 0 0 0 0 0.000 0.0000000 0.000000e+00
Legis9 3.0 0 0 0 0 0.000 0.0000000 0.000000e+00
@RCura
RCura / ggvis_CA.R
Created December 26, 2014 17:28
ggvis issue - multiple layers on different dataset
# Create dummy data
a <- rnorm(n = 100, mean = 50, sd = 5)
b <- rnorm(n = 100, mean = 50, sd = 5)
c <- rnorm(n = 100, mean = 50, sd = 5)
mydf <- data.frame(A = a, B = b, C = c, row.names = c(1:100))
library(ade4)
# Running a Correspondence Analysis
myCA <- dudi.coa(df = mydf,scannf = FALSE, nf = 2)
# Getting distances for Hclust
myDist <- dist.dudi(myCA, amongrow = TRUE)
@RCura
RCura / shiny.R
Created September 18, 2014 20:44
require(shiny)
require(sp)
require(rgdal)
runApp(
list(
ui = bootstrapPage(
fileInput('inputdata', 'Input file',accept=c('.csv')),
plotOutput("xyPlot"),
downloadButton('downloadShp', 'DownloadSHP')
),