Run this code in order to download sample data for this tutorial.
if (!file.exists("./data")) { dir.create("./data") }url<-"https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD"download.file(url,destfile="./data/cameras.csv",method="curl")data<-read.csv("./data/cameras.csv")names(data)
Lower or upper case
Split values
For example, split word when there is a dot.
Get only first element
In this example, we will split a string and get only first element.
Replace characters
The following code will replace all _ by empty space.
sub function will always replace only first found characeter. In order to replace all, use gsub.