'Using within function to create and add a factor to a dataframe
Instructed to use the within function as mentioned in the title to avoid the aaup1$ prefix. "aaup1" is the name of the dataframe I am using.
aaup1$stateFac <- factor(aaup1$state)
aaup1$stateFac
aaup1$typeFac <- factor(aaup1$type)
aaup1$typeFac
aaup1
This is the code I wrote and it does what I need it to do but it doesn't use the within function. Looking to create a factor and add it to aaup1 with the within function.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
