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
# Launch a Shiny app with your ggplot object, zoom control added: gg_zoom(g) | |
# Shiny brush event always return numerical values for the zoom box. If the x or y axis is in date, date-time, the zoom box coordinates need to be converted before taken by ggplot. | |
# https://github.com/hadley/scales/blob/38f81a7b79d98c06edd7d0b624c77b7834db508f/R/trans-date.r | |
# this will convert date, datetime axes automatically, though it need lubridate to work because the base R equivalent are more cumbersome to use. | |
library(shiny) | |
library(ggplot2) | |
library(lubridate) | |
ui <- fluidPage( |
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
#' Read windows/mac clipboard into lines | |
#' | |
#' If windows, call \code{utils::readClipboard()}. If mac os, use | |
#' \code{pipe("pbpaste")}. | |
#' | |
#' @return character vector | |
#' @export | |
#' @examples | |
#' clip_read_lines() | |
clip_read_lines <- function(){ |
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
__author__ = 'draco' | |
# split all states loader script into separate scripts by states. | |
# replace all the "set TMPDIR=..." line with ":: ---- end state ----\nset TMPDIR=..." | |
# then delete the first line of ":: ---- end state ----\n" | |
# modify the base file path and output file folder by your case. | |
text_file = open("e:\\Data\\all_states.bat","r") | |
lines = text_file.readlines() | |
text_file.close() | |
print len(lines) |
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
import time | |
__author__ = 'dracodoc' # http://dracodoc.github.io/ | |
# measure script time duration in segments. | |
# the clock value list: start, segments, end | |
# usage: import times, put times.start, seg_start, end etc in line. | |
T = [] | |
Digit = [7] | |