3
I am an experienced SAS programmer but a beginner in R. I am working with Rstudio Version 0.99.903 - 2009-2016 Rstudio, Inc. and Windows 8. I have the following question:
The file "a_us" has 4 numeric fields and 2 alphanumerics as follows:
str(a_us) //command to display the file structure
'data.frame': 1039992 obs. of 7 variables: $ 'dsSisOriginario' : chr "Construcard" "Construcard" "Construcard" "Construcard" ... $ 'nrContrato' : chr "000002160000023630," "000002160000116565," "000002160000225267," ... $ 'vlCredInadimplenciaLancadoCa': num 9570 4455 6791 2678 4483 ... $ 'dtCredInadimplenciaEntradaCa': chr "03/11/2002" "17/10/2004" "25/03/2007" "15/12/2006" ... $ 'vlCredFcvsCessao' : num 271 216 329 130 217 ... $ PercentPagoCarteira : num 0.0283 0.0484 0.0484 0.0484 ... $ QtdCredDiasAtraso : int 5110 4396 3507 3607 2768 2407 2640 ...
Using Summary(a_us) the result comes out as expected, that is, the statistics for the numerical variables are perfect.
However, when I try to take, for example, the average (Mean()) or any other quantitative procedure, such as hist(), of these same numerical variables ('vlCredInmplicationLancadoCa', 'vlCredFcvsCessao', Percentpagocarteira, Qtdcreddiasatraso), it works only for the variables (Percentpagocarteira, Qtdcreddiasatraso), para as outras ('vlCredInadimplenciaLancadoCa', 'vlCredFcvsCessao'), I get the message:
> mean(a_us$'vlCredFcvsCessao') > [1] NA > Warning message: > In mean.default(a_us$vlCredFcvsCessao) : > argumento não é numérico nem lógico: retornando NA
Although the variable is numerical, I get this error message!
Can someone give me a hint of what’s going on and how to fix it?
I’m not the one who denied your question, but her formatting is very confusing and rather difficult to fix. With this, it is difficult to answer your question because it compromises the understanding of the data format, which is fundamental for someone to answer it. However, since I don’t know anything about R, I don’t have much to help.
– Victor Stafusa