Transforming variables
To group the variable Date
into a new variable Period
:
> Period <- Date
> Period[(Date>650)&(Date<=1200)] <- 1
> Period[(Date>100)&(Date<=650)] <- 2
> Period[(Date<=100)] <- 3
> table(Period)
Period
1 2 3
20 18 2
> barplot(table(Period))
> barplot(table(Mat,Period), beside=TRUE)
To create the new variable "maximum length / maximum width ratio",
Lewirat
:
> Lewirat <- Maxle/Maxwi
To create the new variable "socket length as percentage of maximum
length", Socperc
:
> Socperc <- (Socle/Maxle)*100