This file contains hidden or 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
| # Ensure left continuity of a decreasing step function | |
| # First find discontinuities, based on minimum jump size, then make sure there | |
| # is a data point to ensure left continuity there. | |
| lcts <- function(dat, min.jump){ | |
| for(i in 2:nrow(dat)){ | |
| if(dat[i+1,2] - dat[i,2] > min.jump){ # identify discontinuity | |
| dat <- rbind(dat, c(dat[i+1,1], dat[i,2])) # generate left-cts data point |
This file contains hidden or 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
| from collections import OrderedDict | |
| import numpy as np | |
| py2ri_orig = rpy2.robjects.conversion.py2ri | |
| def conversion_pydataframe(obj): | |
| if isinstance(obj, pandas.core.frame.DataFrame): | |
| od = OrderedDict() | |
| for name, values in obj.iteritems(): | |
| if values.dtype.kind == 'O': | |
| od[name] = rpy2.robjects.vectors.StrVector(values) | |
| else: |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| { | |
| "metadata": { | |
| "name": "demo" | |
| }, | |
| "nbformat": 3, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", |
NewerOlder