1
I would like to learn how to manipulate two variables at the same time. An example, I have a training base and a test base for Machine Learning. How could I apply the function Factor both at the same time(Since the code is identical, it only changes the basis), instead of applying one by one? Follow example of the code:
base_teste$sex<-factor(base_teste$sex, levels = c(' Female', ' Male'), labels = c(0, 1))
base_treinamento$sex<-factor(base_treinamento$sex, levels = c(' Female', ' Male'), labels = c(0, 1))
Another example, use the function abs()
both at the same time, instead of:
base_teste<-abs(base_teste)
base_treinamento<-abs(base_treinamento)
I tried to use the primitive function c()
, but I was unsuccessful.
Excellent! I thought there was some form and it was simple. Creating functions really helps a lot. They could create a package that would allow this multiple manipulation.
– Magliari