Dear Community,
it would be great, if you could help me out.
I was given some information about people (age, size, weigh, etc.). I put the data into the matrix "socio".
I then wanted to add the Body Mass Index (BMI) to the matrix, but everytime i do this, the riwnames of the matrix change from [1],[2],[3],[4] to "Gewicht" and I don't know why.
Maybe you can help me out. Please see the code below.
Kind regards,
Stephan
#Erstellen der Vektoren
Alter<- c(15,27,56,43)
Groeße<- c(1.69,1.74,1.98,1.88)
Gewicht<- c(65,71,88,91)
Schuhgroeße<- c(35,39,47,45)
#Erstellen der Matrix "socio"
socio<- cbind(Alter,Groeße,Gewicht,Schuhgroeße)
#Berechnen der BMIs jeder Person
BMIPerson1<- socio[1,3]/(socio[1,2]^2)
BMIPerson2<- socio[2,3]/(socio[2,2]^2)
BMIPerson3<- socio[3,3]/(socio[3,2]^2)
BMIPerson4<- socio[4,3]/(socio[4,2]^2)
BMI<- c(BMIPerson1,BMIPerson2,BMIPerson3,BMIPerson4)
socio<- cbind(socio,BMI)
socio