Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Tom Bush tomfbush

💭
I may be slow to respond.
View GitHub Profile
@tomfbush
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.