knitr::opts_chunk$set(echo = TRUE)
Given an input matrix
example_matrix <- matrix(rexp(100, rate=.5), ncol=20)
normalize <- function(input_matrix) { t(t(input_matrix)/colSums(input_matrix) #spaces ) normalized_matrix <- normalize(example_matrix) #curly braces,
normalize <- function(input_matrix){ require(magrittr) require(dplyr) input_matrix %>% as.data.frame() %>% mutate_all(funs(.-min(.))) %>% mutate_all(funs(./max(.))) %>% return() }
# 1) only using subsetting iris[iris$Sepal.Length < (mean(iris$Sepal.Length) - sd(iris$Sepal.Length)) & iris$Petal.Length < mean(iris$Petal.Length) & iris$Petal.Length/iris$Petal.Width > 3,5] # 2) plot(iris[iris$Sepal.Length < (mean(iris$Sepal.Length) - sd(iris$Sepal.Length)) & iris$Petal.Length < mean(iris$Petal.Length),])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.