Compare commits
No commits in common. "1871414592acb8d0e5fc4e6acad92386e80cd2e4" and "6e3788817e36e0371aaa5193ddb6f70ede5dd2df" have entirely different histories.
1871414592
...
6e3788817e
151
report.html
151
report.html
File diff suppressed because one or more lines are too long
37
report.rmd
37
report.rmd
|
@ -34,27 +34,26 @@ if (!require(moments)) {
|
|||
|
||||
## Frequency Table ordered from wish.com
|
||||
```{r}
|
||||
freq <- function(data, rounded_digits = 2) {
|
||||
# counts
|
||||
total_count <- length(data)
|
||||
freq <- function(data) {
|
||||
na_count <- length(data[is.na(data)])
|
||||
valid_count <- total_count - na_count
|
||||
|
||||
valid_count <- length(data) - na_count
|
||||
frequency <- table(data)
|
||||
p <- prop.table(frequency)
|
||||
valid_percent <- round(p * 100, digits = rounded_digits)
|
||||
na_percent <- round(na_count / length(data) * 100, digits = rounded_digits)
|
||||
|
||||
percent <- round(frequency/total_count*100, digits = rounded_digits)
|
||||
cumulative_percent <- round(cumsum(p) * 100, digits = rounded_digits)
|
||||
freq_table <- cbind(frequency, percent, valid_percent, cumulative_percent)
|
||||
percent <- round(p * 100, digits = 2)
|
||||
frequency_sum <- cumsum(frequency)
|
||||
hkum <- cumsum(p)
|
||||
percent_sum <- round(hkum * 100, digits = 2)
|
||||
freq_table <- cbind(frequency, percent, frequency_sum, percent_sum)
|
||||
valid_percent <- round(valid_count / length(data) * 100, digits = 2)
|
||||
na_percent <- round(na_count / length(data) * 100, digits = 2)
|
||||
|
||||
valid_percent_sum <- sum(as.data.frame(freq_table)$percent)
|
||||
Valid_Total <- c(valid_count, valid_percent_sum, 100, NaN)
|
||||
|
||||
NAs <- c(na_count, na_percent, NaN, NaN)
|
||||
Total <- c(total_count, 100, NaN, NaN)
|
||||
print(rbind(freq_table, Valid_Total, NAs, Total))
|
||||
print(freq_table)
|
||||
|
||||
count <- c(valid_count, na_count, valid_count + na_count)
|
||||
percent <- c(valid_percent, na_percent, valid_percent + na_percent)
|
||||
df <- data.frame(count, percent, row.names = c("valid", "NA", "Total"))
|
||||
print(df)
|
||||
}
|
||||
```
|
||||
*Source: https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret and adapted*
|
||||
|
@ -434,12 +433,6 @@ qqline(age)
|
|||
|
||||
### Historam for age {.tabset}
|
||||
|
||||
#### Frequency {-}
|
||||
```{r}
|
||||
hist(age, freq = F)
|
||||
lines(density(age), lwd = 2, col = "black")
|
||||
```
|
||||
|
||||
#### Auto Breaks {-}
|
||||
```{r}
|
||||
hist(age)
|
||||
|
|
Loading…
Reference in New Issue