added lab 3
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
####################################
|
||||
##### Abalone Data Preparation #####
|
||||
####################################
|
||||
|
||||
# read dataset
|
||||
abalone.data <- read.csv("Courses/Data Analytics/Fall25/labs/lab 3/abalone_dataset.csv")
|
||||
|
||||
## add new column age.group with 3 values based on the number of rings
|
||||
abalone.data$age.group <- cut(abalone.data$rings, br=c(0,8,11,35), labels = c("young", 'adult', 'old'))
|
||||
|
||||
## alternative way of setting age.group
|
||||
abalone.data$age.group[abalone.data$rings<=8] <- "young"
|
||||
abalone.data$age.group[abalone.data$rings>8 & abalone.data$rings<=11] <- "adult"
|
||||
abalone.data$age.group[abalone.data$rings>11 & abalone.data$rings<=35] <- "old"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user