install.packages("beepr")
library(beepr)
beep(sound = 3, expr = NULL) #Fanfare!!
1: "ping"
# Loads current gist with function | |
# https://gist.github.com/timelyportfolio/1405187 | |
# dev.off(); plot(1) | |
library(devtools) | |
source_gist("1405187") | |
require(quantmod) | |
require(PerformanceAnalytics) |
Sets the working directory in R on a Linux system after and are replaced with actual folder names.
Alows for sharing code without each user having to change the HOME variable (e.g., "home/myMachine/Projects/First"
setwd(paste0(Sys.getenv("HOME"),"/<TopDir>/<Root>"))
For Windows, use proper slash direction and notation.
stringToChar<- function( example ){ | |
example <- as.character(example) | |
letters <- strsplit(example,"")[[1]] | |
for (i in letters[1:length(letters)] ) { print(i) } | |
} | |
# Quick GIST I wrote in the Data Science Capstone JHU forum (Dec 2014) | |
# It appears if the one of us draws 5 random tweets or news excerpts as the grading criteria calls for, | |
# the probability that none of the five match the top-word is 32.8%--assuming the | |
# true accuracy of model is 20%. | |
# Overall, if the top-word as criteria for success is used, where 4 reviewers using 5 random samples, | |
# the probability that none of the 20 predictions match the top word is only 1.2%. | |
#Search installed packages by first letter -- regardless of upper/lower case (by 's' here) | |
grep("^[s]", attributes(installed.packages())$dimnames[[1]], value = TRUE, ignore.case = TRUE) |
# #Majority Vote Accuracy | |
# For Johns Hopkins / Machine Learning in R | |
# n <- 5 # Independent Classifiers | |
# k <- 3 # | |
# | |
# accuracy <- 0.7 | |
# | |
# majorityAccu(5, 3, .7) # 83.7% Accuracy | |
# majorityAccu(101, 51, .7) #99.9% Accuracy |