Skip to content

Instantly share code, notes, and snippets.

Tom Bush tomfbush

Block or report user

Report or block tomfbush

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tomfbush / clean.r
Created Nov 22, 2018
Clean a specific column
View clean.r
# function to substitute matching string and everything after it with nothing
# note leading space if that applies to your dataset
removeCrap <- function(crapThing) {
gsub(" (0|[1-9][0-9]*)\ ?(GB).*$", "", crapThing)
# load data from csv into a dataframe
d <- read.csv("input.csv", sep = ",")
# display a few rows of the dataframe 'd'
You can’t perform that action at this time.