我正在使用一个具有两位小数的数值变量的数据集。当我阅读数据集时,它会显示带有小数的变量,但任何分析结果都不会显示小数。
例如。
dados <- read.csv("BANCO.csv",dec=",", sep=";", stringsAsFactors=FALSE)
dput(dados)
structure(list(VAR = c("PJ", "PJ", "PF", "PF", "PJ", "PJ", "PJ",
"PF", "PJ", "PJ", "PF", "PJ", "PJ", "PJ"), Saldo = c(99514,04,
49781,73, 49731,17, 49723,11, 398253,84, 49805,66, 49764,19,
100363,2, 49739,54, 99580,98, 49781,73, 198958,16, 49739,54,
49830,54)), .Names = c("VAR", "Saldo"), class = "data.frame", row.names = c(NA,
-14L))
> summary(dados)
VAR
Length:14
Class :character
Mode :character
Saldo
Min. : 49723
1st Qu.: 49746
Median : 49794
Mean : 96040
3rd Qu.: 99564
Max. :398254
> tapply(dados$Saldo, list(VAR=dados$VAR), sum, na.rm=TRUE)
VAR
PF 6111262
PJ 82400812