Linted
parent
afd7d1babf
commit
51cd711da8
28
report.html
28
report.html
|
@ -1509,8 +1509,8 @@ if (!require(moments)){
|
||||||
<h2><span class="header-section-number">2.1</span> Frequency Table
|
<h2><span class="header-section-number">2.1</span> Frequency Table
|
||||||
ordered from wish.com</h2>
|
ordered from wish.com</h2>
|
||||||
<pre class="r"><code>freq <- function(data) {
|
<pre class="r"><code>freq <- function(data) {
|
||||||
na_count = length(data[is.na(data)])
|
na_count <- length(data[is.na(data)])
|
||||||
valid_count = length(data)-na_count
|
valid_count <- length(data) - na_count
|
||||||
frequency <- table(data)
|
frequency <- table(data)
|
||||||
p <- prop.table(frequency)
|
p <- prop.table(frequency)
|
||||||
percent <- round(p * 100, digits = 2)
|
percent <- round(p * 100, digits = 2)
|
||||||
|
@ -1526,10 +1526,8 @@ ordered from wish.com</h2>
|
||||||
|
|
||||||
count <- c(valid_count, na_count, valid_count + na_count)
|
count <- c(valid_count, na_count, valid_count + na_count)
|
||||||
percent <- c(valid_percent, na_percent, valid_percent + na_percent)
|
percent <- c(valid_percent, na_percent, valid_percent + na_percent)
|
||||||
totall <- c(valid_count+na_count, valid_percent+na_percent)
|
|
||||||
df <- data.frame(count, percent, row.names = c("valid", "NA", "Total"))
|
df <- data.frame(count, percent, row.names = c("valid", "NA", "Total"))
|
||||||
print(df)
|
print(df)
|
||||||
|
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
<p><em>Source: <a href="https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret" class="uri">https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret</a>
|
<p><em>Source: <a href="https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret" class="uri">https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret</a>
|
||||||
and adapted</em></p>
|
and adapted</em></p>
|
||||||
|
@ -1848,7 +1846,6 @@ are NOT numeric.</p>
|
||||||
"A7" = "W007",
|
"A7" = "W007",
|
||||||
"A8" = "W008",
|
"A8" = "W008",
|
||||||
"A9" = "W009",
|
"A9" = "W009",
|
||||||
|
|
||||||
"B1" = "K001",
|
"B1" = "K001",
|
||||||
"B2" = "K002",
|
"B2" = "K002",
|
||||||
"B3" = "K003",
|
"B3" = "K003",
|
||||||
|
@ -1858,37 +1855,30 @@ are NOT numeric.</p>
|
||||||
"B7" = "K007",
|
"B7" = "K007",
|
||||||
"B8" = "K008",
|
"B8" = "K008",
|
||||||
"B9" = "K009",
|
"B9" = "K009",
|
||||||
|
|
||||||
"C1_1" = "TK001_01",
|
"C1_1" = "TK001_01",
|
||||||
"C1_2" = "TK001_02",
|
"C1_2" = "TK001_02",
|
||||||
"C1_3" = "TK001_03",
|
"C1_3" = "TK001_03",
|
||||||
"C1_4" = "TK001_04",
|
"C1_4" = "TK001_04",
|
||||||
|
|
||||||
"C2_1" = "TK002_01",
|
"C2_1" = "TK002_01",
|
||||||
"C2_2" = "TK002_02",
|
"C2_2" = "TK002_02",
|
||||||
"C2_3" = "TK002_03",
|
"C2_3" = "TK002_03",
|
||||||
"C2_4" = "TK002_04",
|
"C2_4" = "TK002_04",
|
||||||
|
|
||||||
"C3_1" = "TK003_01",
|
"C3_1" = "TK003_01",
|
||||||
"C3_2" = "TK003_02",
|
"C3_2" = "TK003_02",
|
||||||
"C3_3" = "TK003_03",
|
"C3_3" = "TK003_03",
|
||||||
"C3_4" = "TK003_04",
|
"C3_4" = "TK003_04",
|
||||||
|
|
||||||
"C4_1" = "TK004_01",
|
"C4_1" = "TK004_01",
|
||||||
"C4_2" = "TK004_02",
|
"C4_2" = "TK004_02",
|
||||||
"C4_3" = "TK004_03",
|
"C4_3" = "TK004_03",
|
||||||
"C4_4" = "TK004_04",
|
"C4_4" = "TK004_04",
|
||||||
|
|
||||||
"C5_1" = "TK005_01",
|
"C5_1" = "TK005_01",
|
||||||
"C5_2" = "TK005_02",
|
"C5_2" = "TK005_02",
|
||||||
"C5_3" = "TK005_03",
|
"C5_3" = "TK005_03",
|
||||||
"C5_4" = "TK005_04",
|
"C5_4" = "TK005_04",
|
||||||
|
|
||||||
"C6_1" = "TK006_01",
|
"C6_1" = "TK006_01",
|
||||||
"C6_2" = "TK006_02",
|
"C6_2" = "TK006_02",
|
||||||
"C6_3" = "TK006_03",
|
"C6_3" = "TK006_03",
|
||||||
"C6_4" = "TK006_04",
|
"C6_4" = "TK006_04",
|
||||||
|
|
||||||
"D1_1" = "H001_001",
|
"D1_1" = "H001_001",
|
||||||
"D1_2" = "H001_002",
|
"D1_2" = "H001_002",
|
||||||
"D1_3" = "H001_003",
|
"D1_3" = "H001_003",
|
||||||
|
@ -1896,23 +1886,15 @@ are NOT numeric.</p>
|
||||||
"D1_5" = "H001_005",
|
"D1_5" = "H001_005",
|
||||||
"D1_6" = "H001_006",
|
"D1_6" = "H001_006",
|
||||||
"D1_7" = "H001_007",
|
"D1_7" = "H001_007",
|
||||||
|
|
||||||
"D2" = "H002",
|
"D2" = "H002",
|
||||||
|
|
||||||
"D3" = "H003",
|
"D3" = "H003",
|
||||||
|
|
||||||
"D4" = "H004",
|
"D4" = "H004",
|
||||||
"D4_comment" = "H004_other",
|
"D4_comment" = "H004_other",
|
||||||
|
|
||||||
"D5" = "H005",
|
"D5" = "H005",
|
||||||
"D5_comment" = "H005_other",
|
"D5_comment" = "H005_other",
|
||||||
|
|
||||||
"D6" = "H006",
|
"D6" = "H006",
|
||||||
|
|
||||||
"D7" = "H007",
|
"D7" = "H007",
|
||||||
|
|
||||||
"D8" = "H008",
|
"D8" = "H008",
|
||||||
|
|
||||||
"E1" = "R1"
|
"E1" = "R1"
|
||||||
)</code></pre>
|
)</code></pre>
|
||||||
<p>Then we change the datatype and fix the values</p>
|
<p>Then we change the datatype and fix the values</p>
|
||||||
|
@ -2280,8 +2262,10 @@ Data</h2>
|
||||||
count(value) %>%
|
count(value) %>%
|
||||||
mutate(percentage = prop.table(n) * 100)
|
mutate(percentage = prop.table(n) * 100)
|
||||||
print(tmp, n = 100)
|
print(tmp, n = 100)
|
||||||
ggplot(tmp,
|
ggplot(
|
||||||
aes(x = value, y=n)) +
|
tmp,
|
||||||
|
aes(x = value, y = n)
|
||||||
|
) +
|
||||||
geom_bar(stat = "identity") +
|
geom_bar(stat = "identity") +
|
||||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||||
}</code></pre>
|
}</code></pre>
|
||||||
|
|
29
report.rmd
29
report.rmd
|
@ -35,8 +35,8 @@ if (!require(moments)){
|
||||||
## Frequency Table ordered from wish.com
|
## Frequency Table ordered from wish.com
|
||||||
```{r}
|
```{r}
|
||||||
freq <- function(data) {
|
freq <- function(data) {
|
||||||
na_count = length(data[is.na(data)])
|
na_count <- length(data[is.na(data)])
|
||||||
valid_count = length(data)-na_count
|
valid_count <- length(data) - na_count
|
||||||
frequency <- table(data)
|
frequency <- table(data)
|
||||||
p <- prop.table(frequency)
|
p <- prop.table(frequency)
|
||||||
percent <- round(p * 100, digits = 2)
|
percent <- round(p * 100, digits = 2)
|
||||||
|
@ -52,10 +52,8 @@ freq <- function(data){
|
||||||
|
|
||||||
count <- c(valid_count, na_count, valid_count + na_count)
|
count <- c(valid_count, na_count, valid_count + na_count)
|
||||||
percent <- c(valid_percent, na_percent, valid_percent + na_percent)
|
percent <- c(valid_percent, na_percent, valid_percent + na_percent)
|
||||||
totall <- c(valid_count+na_count, valid_percent+na_percent)
|
|
||||||
df <- data.frame(count, percent, row.names = c("valid", "NA", "Total"))
|
df <- data.frame(count, percent, row.names = c("valid", "NA", "Total"))
|
||||||
print(df)
|
print(df)
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
*Source: https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret and adapted*
|
*Source: https://tellmi.psy.lmu.de/tutorials/deskriptive-statistiken-und-grafiken.html#haeufigkeiten-diskret and adapted*
|
||||||
|
@ -131,7 +129,6 @@ litdata <- litdata %>% rename(
|
||||||
"A7" = "W007",
|
"A7" = "W007",
|
||||||
"A8" = "W008",
|
"A8" = "W008",
|
||||||
"A9" = "W009",
|
"A9" = "W009",
|
||||||
|
|
||||||
"B1" = "K001",
|
"B1" = "K001",
|
||||||
"B2" = "K002",
|
"B2" = "K002",
|
||||||
"B3" = "K003",
|
"B3" = "K003",
|
||||||
|
@ -141,37 +138,30 @@ litdata <- litdata %>% rename(
|
||||||
"B7" = "K007",
|
"B7" = "K007",
|
||||||
"B8" = "K008",
|
"B8" = "K008",
|
||||||
"B9" = "K009",
|
"B9" = "K009",
|
||||||
|
|
||||||
"C1_1" = "TK001_01",
|
"C1_1" = "TK001_01",
|
||||||
"C1_2" = "TK001_02",
|
"C1_2" = "TK001_02",
|
||||||
"C1_3" = "TK001_03",
|
"C1_3" = "TK001_03",
|
||||||
"C1_4" = "TK001_04",
|
"C1_4" = "TK001_04",
|
||||||
|
|
||||||
"C2_1" = "TK002_01",
|
"C2_1" = "TK002_01",
|
||||||
"C2_2" = "TK002_02",
|
"C2_2" = "TK002_02",
|
||||||
"C2_3" = "TK002_03",
|
"C2_3" = "TK002_03",
|
||||||
"C2_4" = "TK002_04",
|
"C2_4" = "TK002_04",
|
||||||
|
|
||||||
"C3_1" = "TK003_01",
|
"C3_1" = "TK003_01",
|
||||||
"C3_2" = "TK003_02",
|
"C3_2" = "TK003_02",
|
||||||
"C3_3" = "TK003_03",
|
"C3_3" = "TK003_03",
|
||||||
"C3_4" = "TK003_04",
|
"C3_4" = "TK003_04",
|
||||||
|
|
||||||
"C4_1" = "TK004_01",
|
"C4_1" = "TK004_01",
|
||||||
"C4_2" = "TK004_02",
|
"C4_2" = "TK004_02",
|
||||||
"C4_3" = "TK004_03",
|
"C4_3" = "TK004_03",
|
||||||
"C4_4" = "TK004_04",
|
"C4_4" = "TK004_04",
|
||||||
|
|
||||||
"C5_1" = "TK005_01",
|
"C5_1" = "TK005_01",
|
||||||
"C5_2" = "TK005_02",
|
"C5_2" = "TK005_02",
|
||||||
"C5_3" = "TK005_03",
|
"C5_3" = "TK005_03",
|
||||||
"C5_4" = "TK005_04",
|
"C5_4" = "TK005_04",
|
||||||
|
|
||||||
"C6_1" = "TK006_01",
|
"C6_1" = "TK006_01",
|
||||||
"C6_2" = "TK006_02",
|
"C6_2" = "TK006_02",
|
||||||
"C6_3" = "TK006_03",
|
"C6_3" = "TK006_03",
|
||||||
"C6_4" = "TK006_04",
|
"C6_4" = "TK006_04",
|
||||||
|
|
||||||
"D1_1" = "H001_001",
|
"D1_1" = "H001_001",
|
||||||
"D1_2" = "H001_002",
|
"D1_2" = "H001_002",
|
||||||
"D1_3" = "H001_003",
|
"D1_3" = "H001_003",
|
||||||
|
@ -179,23 +169,15 @@ litdata <- litdata %>% rename(
|
||||||
"D1_5" = "H001_005",
|
"D1_5" = "H001_005",
|
||||||
"D1_6" = "H001_006",
|
"D1_6" = "H001_006",
|
||||||
"D1_7" = "H001_007",
|
"D1_7" = "H001_007",
|
||||||
|
|
||||||
"D2" = "H002",
|
"D2" = "H002",
|
||||||
|
|
||||||
"D3" = "H003",
|
"D3" = "H003",
|
||||||
|
|
||||||
"D4" = "H004",
|
"D4" = "H004",
|
||||||
"D4_comment" = "H004_other",
|
"D4_comment" = "H004_other",
|
||||||
|
|
||||||
"D5" = "H005",
|
"D5" = "H005",
|
||||||
"D5_comment" = "H005_other",
|
"D5_comment" = "H005_other",
|
||||||
|
|
||||||
"D6" = "H006",
|
"D6" = "H006",
|
||||||
|
|
||||||
"D7" = "H007",
|
"D7" = "H007",
|
||||||
|
|
||||||
"D8" = "H008",
|
"D8" = "H008",
|
||||||
|
|
||||||
"E1" = "R1"
|
"E1" = "R1"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
@ -289,7 +271,6 @@ litdata$D7 <- as.numeric(litdata$D7)
|
||||||
litdata$D8 <- as.factor(litdata$D8)
|
litdata$D8 <- as.factor(litdata$D8)
|
||||||
|
|
||||||
# skipping E1 because it's a free text
|
# skipping E1 because it's a free text
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -323,8 +304,10 @@ displayFunction1 <- function(table, column) {
|
||||||
count(value) %>%
|
count(value) %>%
|
||||||
mutate(percentage = prop.table(n) * 100)
|
mutate(percentage = prop.table(n) * 100)
|
||||||
print(tmp, n = 100)
|
print(tmp, n = 100)
|
||||||
ggplot(tmp,
|
ggplot(
|
||||||
aes(x = value, y=n)) +
|
tmp,
|
||||||
|
aes(x = value, y = n)
|
||||||
|
) +
|
||||||
geom_bar(stat = "identity") +
|
geom_bar(stat = "identity") +
|
||||||
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
theme(axis.text.x = element_text(angle = 45, hjust = 1))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue