New Variables
Get some data to summarize
if (!file.exists("./data")) { dir.create("./data") }
url <- "https://data.baltimorecity.gov/api/views/k5ry-ef3g/rows.csv?accessType=DOWNLOAD"
download.file(url, destfile="./data/restaurants.csv", method="curl")
data <- read.csv("./data/restaurants.csv")How to create a sequence
> seq(1, 10, by=2)
[1] 1 3 5 7 9Create new column by subsetting.
Create binary column
Create categorical values
Create factor values
Levels of factor variables
Mutate function
Transformations
Last updated