Skip to content

Instantly share code, notes, and snippets.

@Inpirical-Coder
Inpirical-Coder / svm_rsi_trend.R
Created November 6, 2014 02:05
Trains and tests SVM on two features (relative strength index and trend over x observations)
# Some code to asses an SVM with a two-dimensional feature space:
# trend (price - simple moving average) and relative strength index.
# The code is an adaptation of the code found in the following linkedin post:
# "Trading the RSI using a Support Vector Machine"
# "https://www.linkedin.com/pulse/article/20141103165037-172934333-trading-the-rsi-using-a-support-vector-machine"
# Settings
sma.window = 50 # Number of observations in simple moving average.
rsi.window = 3 # Number of observation in relative strength index (RSI)
@ramnathv
ramnathv / README.md
Created January 30, 2014 00:33
Creating PDF Version of Slidify Presentations

This gist consists of a makefile and a script that can automate the creation of PDFs from Slidify generated HTML slides. The script assumes that the makefile and the script makepdf.js are in the same directory as the Rmd file. The makepdf.js script uses casperjs, a very useful utility to automate tasks that require browser interaction. You may follow the installation instructions on the casperjs website, to make sure that you have all the dependencies correctly installed before trying this out.

@josecarlosgonz
josecarlosgonz / geojson.R
Last active May 17, 2021 10:28
How to create a geojson file in R from a dataframe
#Write geojson
#====
#Load libraries
library(rgdal)
#dataMap is a dataframe with coordinates on cols 11 (LATITUDE) and 12 (LONGITUDE)
#Transfor coordinates to numeric
dataMap$LATITUDE <- as.numeric(dataMap$LATITUDE)
dataMap$LONGITUDE <- as.numeric(dataMap$LONGITUDE)
@mbacou
mbacou / snippets.R
Last active March 20, 2022 23:46
Working with attributes inside SpatialPolygonsDataFrame objects
## Example procedure for working with data (attributes) inside SpatialPolygonsDataFrame objects
# Load my favorite libraries for that sort of work
library(data.table)
library(rgdal)
# Load 2 shapefiles that, say, we want to merge.
# Note that you can read pretty much any spatial format using readOGR().
tza.l2 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L2")
tza.l1 <- readOGR("./analysis/TZA-AC-07/maps", "tza-ac-07_L1")