This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install_postgres.notes | |
# Notes on install RPostgreSQL on MAC OS X Mavericks & later | |
# original source: | |
# http://computersandbuildings.com/how-to-install-rpostgresql-on-osx-mavericks/: | |
1) install.packages('devtools') (if don't already have them) | |
2) install.packages('DBI') | |
3) download source RPostgreSQL tarball from: | |
http://cran.r-project.org/web/packages/RPostgreSQL/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install Bash 4 using homebrew | |
brew install bash | |
# Or build it from source... | |
curl -O http://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz | |
tar xzf bash-4.2.tar.gz | |
cd bash-4.2 | |
./configure --prefix=/usr/local/bin && make && sudo make install | |
# Add the new shell to the list of legit shells |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## install Haskell Platform on Mac OS | |
(1) Download from https://www.haskell.org/platform/ | |
> Contains the GHCi REPL shell (console-interpreter), common vetted libraries, Cabal, etc. | |
> See https://www.haskell.org/platform/doc/2014.2.0.0/start.html for more information | |
(2) Um ... that should be it on Mavericks (v. 10.9.+). You may run into problems if you had GHC/i installed already on your Mac and then upgraded to Mavericks. Look up @cartazio or @katchuang gists in these cases. | |
(3) Do you a Haskell for a Great Good! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# alteRyx_install_packages.R | |
# > code to install packages via R Developer tool in Alteryx(R) module | |
# > note call to custom Alteryx-R function wrte.Alteryx() | |
altx.repo <- getOption("repos") | |
altx.repo["CRAN"] <- "http://cran.rstudio.com" # set your primary repo if you haven't already | |
options(repos = altx.repo) | |
#write.Alteryx(getOption("repos"), 1) # DEBUG | |
install.packages("XML") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Get the FileGDB API http://www.esri.com/apps/products/download/ | |
2) Extract it somewhere on your system and remember the path :) | |
3) Do: | |
> mkdir build #directory where we are playing around | |
> cd build | |
> git clone https://github.com/OSGeo/gdal.git | |
> cd gdal | |
> ./configure --with-fgdb=/path/to/your/FileGDB_API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cumRelFreqDistn(tups): | |
# create bins of increment 0.01 | |
a = [i*-0.01 for i in range(100)] | |
a = a[1:len(a)] | |
b = [i*0.01 for i in range(101)] | |
a.extend(b) | |
a.sort() | |
bins = a | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library('bitops') | |
library('RCurl') | |
library('RJSONIO') | |
query = function(querystring) { | |
h = basicTextGatherer() | |
curlPerform(url="http://<your host IP>/db/data/ext/CypherPlugin/graphdb/execute_query", | |
postfields=paste('query',curlEscape(querystring), sep='='), | |
writefunction = h$update, | |
verbose = FALSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### manage memory on a large data set using multicore library | |
library(multicore) | |
# read in tab-delimited file from working dir | |
df = read.table(getwd(), sep="\t", header=T) | |
d.lines = as.character(df$charvar) # $charvar is character-class variable you want to grep | |
grep_wrap <- function (pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE, fixed = FALSE, useBytes = FALSE, invert = FALSE) { | |
ret = rep(0, length(x)) | |
ret[grep(pattern, x, ignore.case, perl, value, fixed, useBytes, invert)] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JDBC driver library for R | |
library("RJDBC") | |
user <- "cgutierrez" # enter your own username | |
#pwd <- # enter in URL str below | |
# I chose open-source JTDS for a particular reason in this example (not related to R); you might choose another one | |
# Check that appropriate .jar is in indicated directory | |
drv <- JDBC("net.sourceforge.jtds.jdbc.Driver", "/usr/share/java/drivers/jdbc/jtds-1.2.7.jar", identifier.quote="`") | |
cxn <- dbConnect(drv, "jdbc:jtds:sqlserver://MYSERVER01ABC;useNTLMv2=true;domain=MY.DOMAIN.COM", user, #####) # enter pwd at runtime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use plyr package | |
library(plyr) | |
### READ all files in working directory into a list of dataframes | |
d.list=lapply(list.files(getwd(), full = F), FUN = read.table, header=T, sep="\t", fill=T) # name data | |
### SEPARATE out data frames from list -- using a for-loop in this example | |
i=0 | |
f.coll=list.files() |
NewerOlder