diff --git a/report.html b/report.html index 79b2b00..486b0f6 100644 --- a/report.html +++ b/report.html @@ -1544,6 +1544,12 @@ and adapted
uniqv[which(x == max(x))] } +removeNA <- function(d){
+ return(d[!is.na(d)])
+}
+We have the year 2021 ## Preparation
-birthyears <- litdata$D7
-# remove NAs
-birthyears <- birthyears[!is.na(birthyears)]
+# remove NAs
+birthyears <- removeNA(litdata$D7)
age <- 2021 - birthyears
6.1 Frequency
diff --git a/report.rmd b/report.rmd
index 6e61382..adb60b6 100644
--- a/report.rmd
+++ b/report.rmd
@@ -71,6 +71,15 @@ getmode <- function(v) {
}
```
+## Remove NA
+```{r}
+removeNA <- function(d){
+ return(d[!is.na(d)])
+}
+```
+
+
+
# Load Data
## Load from CSV
``` {r loadData}
@@ -352,9 +361,8 @@ displayFunction1(litdata, "D8")
We have the year 2021
## Preparation
```{r}
-birthyears <- litdata$D7
# remove NAs
-birthyears <- birthyears[!is.na(birthyears)]
+birthyears <- removeNA(litdata$D7)
age <- 2021 - birthyears
```