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
Building Opencv to add custom format support: | |
############################################### | |
Prerequisites: | |
-------------- | |
opencv source - Download the required opencv version for Linux with the | |
following link. (http://opencv.org/downloads.html) | |
Dependencies : |
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
RGB2All<-function (data=RGB, R="R", G="G", B="B", name.ext="", deg.obs=2, illum="C"){ | |
#Setting up variables in dataframe | |
data[[paste("X", name.ext, sep="")]]<-NA | |
data[[paste("Y", name.ext, sep="")]]<-NA | |
data[[paste("Z", name.ext, sep="")]]<-NA | |
data[[paste("L", name.ext, sep="")]]<-NA | |
data[[paste("a", name.ext, sep="")]]<-NA | |
data[[paste("b", name.ext, sep="")]]<-NA |
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
Lab2All<-function(data=Lab, L="L", a="a", b="b", name.ext="", deg.obs=2, illum="C"){ | |
#Setting up variables in dataframe | |
data[[paste("C", name.ext, sep="")]]<-NA | |
data[[paste("H", name.ext, sep="")]]<-NA | |
data[[paste("X", name.ext, sep="")]]<-NA | |
data[[paste("Y", name.ext, sep="")]]<-NA | |
data[[paste("Z", name.ext, sep="")]]<-NA | |
data[[paste("R", name.ext, sep="")]]<-NA | |
data[[paste("G", name.ext, sep="")]]<-NA |
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(tidyverse) | |
project_two <- readr::read_csv( | |
'ID, GROUP, value1, value2 | |
1 , 1, 1, 1 | |
1 , 1, 1, 2 | |
2 , 1, 2, 1 | |
2 , 1, 2, 2 | |
1 , 2, 3, 1 | |
1 , 2, 3, 2 |
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(tidyverse) | |
#----------------------------------------------------------------------------- | |
# Some complicated function to calculate things. | |
#----------------------------------------------------------------------------- | |
complex_func <- function(df) { | |
cat("processing: ", first(df[['ID']]), "\n") | |
# 100 lines of code go here. |
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
################################################ | |
#Correlation matrix plot | |
raw.data <- raw.data[complete.cases(raw.data),] | |
c<-cor(raw.data[colstart:colend]) | |
#Correlation p-value tests | |
cor.pvalues <- function(X){ |
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(tidyverse) | |
lagshow <- | |
data.frame(x= rep(1:10, 14), | |
y = rep(1:10, 14), | |
color = rep(rep(c("A", "B"), each = 10), 7), | |
lag = rep(-3:3, each=20) | |
) %>% | |
mutate(x = if_else(color == "A", x-lag, x)) | |
ggplot(lagshow, aes(x = x, y = y, colour = color, shape = color)) + |
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(tidyverse) | |
library(animation) | |
library(tweenr) | |
library(gtools) | |
income <- read_csv("income.csv") | |
income_levels <- mixedsort(unique(income$income_level)) | |
income_levels <- c(income_levels[16], income_levels[1:15]) | |
income <- income %>% mutate(income_level=factor(income_level, |
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(tidyverse) | |
# This is the example I used to show pwalk iterating and printing out things | |
#perhaps this is a horrible example and I'm using it incorrectly? | |
# if you substitute pmap for pwalk, you get exactly the same output. | |
# make a simple plotting function | |
plot_points <- function(t) ggplot(t, aes(mpg, wt)) + geom_point() | |
#function that prints cylinder info, ggplot, and table |
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(tidyverse) | |
library(GGally) | |
nba = read.csv("http://datasets.flowingdata.com/ppg2008.csv") | |
nba1 <- | |
sample_n(nba, 40) %>% | |
as_tibble() %>% | |
mutate(league = 1) |