I think it makes a difference if I want to use a classification method like
rpart () or if I use a modelling approach like glm().
Many thanks for the kind and fast help. I am still very untrained and it is
difficult for me to create such codes.
B.
Eik Vettorazzi wrote:
>
> Ok, then treat them
Ok, then treat them as factors - but if they are really binary and coded
0 and 1, which kind of calculation would lead to different results for a
"factor" instead of a numeric variable?
Anyway,
ABC<-as.data.frame(cbind(A,B,C))
aggregate(ABC[,2:3],by=list(A),FUN=function(x)sum(x=='1')) # '1' i
Thanks for your answer.
It is intended, that the variables are treated as class factor, because
these are binary variables with, for example, the presence or the absence of
a plant organ.
As far as I understood, I have to treat them for other calculations as
factor. Therefore I classified these v
First of all your construction of ABC leads to a structure with 3 factor
variables due to the way cbind processes the input variables - which is
not intended I think.
You can do sth like
ABC<-data.frame(A,B,C)
aggregate(ABC[,2:3],by=list(A),sum)
hth.
Birgitle schrieb:
Hello R-Users!
I nee
4 matches
Mail list logo