This is a proof-of-concept on how one can use RStudio to livecode D3 visualizations.
You will need to install a couple of packages before getting started
devtools::install_github("yihui/servr")| import argparse | |
| import cv2 | |
| import numpy as np | |
| MIN_MATCH_COUNT = 10 | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("-i1", "--trainimage", required = True, help = "Path to the image") | |
| ap.add_argument("-i2", "--queryimage", required = True, help = "Path to the image") | |
| args = vars(ap.parse_args()) |
| import argparse | |
| import trans #pip install trans | |
| import time | |
| import cv2 | |
| import math | |
| import pandas as pd | |
| import numpy as np | |
| def distance(p, q): | |
| return math.sqrt(math.pow(math.fabs(p[0]-q[0]),2)+math.pow(math.fabs(p[1]-q[1]),2)) |
| R version 3.3.0 (2016-05-03) -- "Supposedly Educational" | |
| Copyright (C) 2016 The R Foundation for Statistical Computing | |
| Platform: x86_64-apple-darwin13.4.0 (64-bit) | |
| R is free software and comes with ABSOLUTELY NO WARRANTY. | |
| You are welcome to redistribute it under certain conditions. | |
| Type 'license()' or 'licence()' for distribution details. | |
| Natural language support but running in an English locale |
| library(feather) |
| library(dplyr) | |
| library(tidyr) | |
| no_col <- max(count.fields("https://gist.githubusercontent.com/bhive01/ad5f2f51b02aed0ccfbd50ee3bb8dd68/raw/e0a66e51c88da13861bfa9f624aef5bb62cbfb32/fruitshape.txt", sep = ",")) | |
| cukeshape <- read.table("https://gist.githubusercontent.com/bhive01/ad5f2f51b02aed0ccfbd50ee3bb8dd68/raw/e0a66e51c88da13861bfa9f624aef5bb62cbfb32/fruitshape.txt",sep=",",fill=TRUE,col.names=1:no_col) | |
| tcukeshape <- as.data.frame(t(cukeshape)) | |
| tcukeshape %>% | |
| gather(., fruit, width) %>% |
| library(devtools) | |
| library(iotools) | |
| library(R.utils) | |
| library(feather) # install_github("wesm/feather/R") | |
| library(microbenchmark) | |
| library(data.table) | |
| library(readr) | |
| library(ggplot2) | |
| library(plotly) |
| L.shell.Day5 a.shell.Day5 b.shell.Day5 Hex.shell.Day5 L.shell.Day1 a.shell.Day1 b.shell.Day1 Hex.shell.Day1 | |
| 61.1824499603039 -22.076387665463 32.2221171514149 #8A9F68 59.1700367857259 -22.0471225002006 34.9234624183896 #859758 | |
| 56.8621418223068 -24.97288907957 42.0601786964881 #778D3B 51.5169668478454 -23.9252046480325 36.6068073530096 #627A37 | |
| 62.7257035685657 -22.9733681151521 35.8083291448731 #8AA164 57.7975941354515 -22.202011261358 35.4614903698262 #809651 | |
| 59.9427072331491 -23.4729626916318 34.455617994546 #809957 55.2358856160348 -21.9162837108123 35.5743258652009 #778C49 | |
| 63.6548194655096 -24.6867708185501 44.698102412673 #8DA34C 54.0763291124911 -21.8893308495491 35.6211872004396 #748946 | |
| 67.5740105523698 -23.8259047306477 45.808160158852 #9AAD54 58.3355995894783 -24.1634822371787 37.4696438729551 #7C954D | |
| 73.2291440290129 -21.7287032147082 38.4157268985132 #AABB72 61.9082465991772 -20.7769111456906 31.9351191059027 #899D61 | |
| 58.871658635331 -23.2615793573258 37.1729800997476 #7F964F 57.398673319426 -22.7656 |
| require(ggplot2) | |
| require(dplyr) | |
| require(plotly) | |
| test <- data.frame(year = rep(2001:2016, each=10), group= rep(LETTERS[1:16], times = 10), count = runif(160)) | |
| gg <- ggplot(test, aes(x=year, y = count, group = group, colour = group)) + | |
| geom_point() + | |
| geom_line() | |
| gg |
| require(dplyr) | |
| # input data frame | |
| df1 <- data.frame(trait=rep(1:10, 4), Trait.Code = rep(LETTERS[1:4], each = 10), Alpha_Value= rep(c(NA, "1", NA, "Alphastuff"), each = 10), Number_Value = rep(c(3, NA, 6, NA), each = 10), stringsAsFactors= FALSE) | |
| df1 %>% | |
| mutate(n=row_number()) %>% #add index for later join | |
| filter(!is.na(Alpha_Value), Alpha_Value != "NULL") %>% # Alpha_Value != NULL or NA | |
| group_by(Trait.Code) %>% #group for mutate | |
| mutate(Converted_Value = ifelse(any(is.na(as.numeric(.$Alpha_Value))), NA, as.numeric(Alpha_Value))) %>% |