Last active
October 19, 2015 03:25
-
-
Save cdated/73f2c5693943be513388 to your computer and use it in GitHub Desktop.
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
# Split into training and test sets | |
trainIndex <- createDataPartition(students$grade, p = 0.9, | |
list = FALSE, | |
times = 1) | |
studentsTrain <- students[ trainIndex,] | |
studentsTest <- students[-trainIndex,] | |
# Create a proportion table | |
prop.table(table(loansTrain$default)) | |
# Root Mean Squared Error (RMSE) | |
library(hydroGOF) | |
error <- rmse(results$prediction, results$actual) | |
# Filter out rows with non-numberical invalid ids | |
loans <- loans[grep("^\\d+$", loans$id),] | |
# Barplot of factors | |
barplot(table(ownedNotes$CREDIT_TREND)) | |
# Rename column | |
library(plyr) | |
rename(d, c("beta"="two", "gamma"="three")) | |
# Find duplicated rows | |
vocabulary[duplicated(vocabulary$id),] | |
# Write CSV in R without row counts | |
write.csv(MyData, file = "MyData.csv",row.names=FALSE) | |
# Colors in a range | |
color_foo <- colorRampPalette(c("lightblue", "darkblue")) | |
colors <- color_foo(3) | |
# Prompt user for value and save as integer | |
readinteger <- function() | |
{ | |
val <- readline(prompt="Please, enter an integer: ") | |
val <- as.integer(val) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment