Hello everyone, I am a bit confused.
I need to change column two in my data set to a factor (see upload for dataset):
2021HelicopterPlanWithResponseData.pdf (44.1 KB)
When I use:
hdata[,2] <- as.factor(hdata[,2])
I get this warning:
In xtfrm.data.frame(x) : cannot xtfrm data frames
However, when I use:
wing.length = as.factor(hdata$Wing.Length)
It creates the factor I need.
My professor gave us the first code that gets the warning. He said we need to use that code so that R will treat column two as a factor.
Is the wing. length code the same as the hdata[,2]? Or does the hdata[,2] change the data frame when the wing.length code does not? Is there another way to get around the original error?