Created
September 22, 2017 00:31
-
-
Save ErickWendel/fec27162a8dff9dbc3c711b587e47775 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Calcule Media, Max, Min, Moda, Media, Variância e | |
| #Desvio Padrão dos atributos possíveis. | |
| setwd('/home/rstudio/impacta/POS-BI_AULA_31082017/aula4/') | |
| db1 <- read.table("5_TRANSACAO.txt",header = T,sep="|") | |
| head(db1, 2) | |
| values <- as.numeric(gsub(",", ".", db1$Valor)) | |
| dates <- as.Date(db1$Vencimento) | |
| #1 | |
| #return moda | |
| getmode <- function(v) { | |
| uniqv <- unique(v) | |
| uniqv[which.max(tabulate(match(v, uniqv)))] | |
| } | |
| #media | |
| mean(values, na.rm = T) | |
| #max | |
| max(values) | |
| max(dates) | |
| #min | |
| min(values) | |
| min(dates) | |
| #moda valor | |
| getmode(values) | |
| getmode(dates) | |
| getmode(db1$NumeroTitulo) | |
| #media | |
| median(values) | |
| #variancy | |
| var(values) | |
| var(dates) | |
| #desvio padrao | |
| sd(values) | |
| sd(dates) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment