Skip to content

Instantly share code, notes, and snippets.


Clark Fitzgerald clarkfitzg

  • Math and Stats Department
  • CSU Sacramento
View GitHub Profile
View test_gist
# Checking to see how this saves. What will it look like?
# Not sure
x <- 1:10
clarkfitzg / graph_conv_rate.R
Created Oct 4, 2013
This is from a brief talk given at a BARUG meetup on October 2013. It creates a powerpoint friendly graph of some currency conversion rate data points.
View graph_conv_rate.R
# Clark 9/27/13
# This script graphs the conversion rate data
# You'll need to change the file.path parameter to the location of your data.
file.path <- "/home/shared/barug_oct13/hourly_rate.csv"
clarkfitzg / get_conv_rate.R
Last active Dec 24, 2015
This script scrapes a current exchange rate and writes it to a csv file. It's meant to be automated using Linux crontab. To have it run every hour you would type something like this: ~$ crontab -e 0 * * * * sudo R CMD BATCH /home/shared/barug_oct13/get_conv_rate.R
View get_conv_rate.R
# Clark Fitzgerald 23 Sep 13
# This script gets current exchange rates and writes to csv file.
csv.path <- "/home/shared/barug_oct13/hourly_rate.csv"
# We'll compare the conversion rate from US to South Korea.
country <- "korea"
View iidata.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
clarkfitzg / ddR_parts.R
Last active Jul 14, 2016
Creating and accessing the parts of a nonuniform distributed array
View ddR_parts.R
> library(ddR)
Welcome to 'ddR' (Distributed Data-structures in R)!
For more information, visit:
Attaching package:ddR
The following objects are masked frompackage:base:
cbind, rbind
clarkfitzg / keyvalue.R
Created Jul 18, 2016
Use serialization to store arbitrary R objects as key value pairs in Spark DataFrames
View keyvalue.R
# Mon Jul 18 08:08:09 PDT 2016
# Goal: Store arbitrary objects in DataFrames as bytes to make dapply more
# general
# Inefficient- this uses CLOB rather than BLOB
# Comments throughout this question are helpful
clarkfitzg / simple_parallel.R
Created Nov 17, 2016
For tutorial on Nov 17, 2016
View simple_parallel.R
# A very simple parallel program
# We specify the probability that each individual
# votes for a candidate, and then simulate the counts
# for n such voters.
# count_votes and count_votes_slow are the functions
# to parallelize. Typically each run will take some
# time to complete.
clarkfitzg /
Created Dec 17, 2016
Calling "ripser" from R

First install ripser.

Then make it locatable on your system PATH, something like:

$ ln -s /home/clark/dev/ripser/ripser /usr/local/bin/ripser

After this your system should be able to find ripser:

$ which ripser
View shuffle.R
x = 1:3
y = 11:13
# Given vectors x, y, what's the cleanest general way to make z?
# z = c(1, 11, 2, 12, 3, 13)
shuffle = function(x, y)
as.vector(mapply(c, x, y))
clarkfitzg /
Last active Mar 24, 2017
Comparing groupby speed in pandas versus R data.table
require(data.table) # v1.10.0
n_smpl = 1e6
ni = 5
id = rep(1:n_smpl, each = ni)
smpl = data.table(id)
smpl[, time := 1:.N, by = id]
a_init = 1; b_init = 1