I'm working with a dataframe with 16 colums right? I want to calculate the mean of the values in one of them,
The funny thing is, it only works when I call it using $
mean(datospractica$REGISTRO)
[1] 2202
but when I call, the exact same colum using [] I get these.
mean(datospractica[1])
[1] NA Warning message: In mean.default(datospractica[1]) : argument is not numeric or logical: returning NA
so, wtf? is it not that $ should be equivalent to [] ? Why does it not work in the second case?
it also does not work like this
mean(datospractica["REGISTRO"])
[1] NA Warning message: In mean.default(datospractica["REGISTRO"]) : argument is not numeric or logical: returning NA
I have double checked, it is the same column, so, why does this happen?