Function to remove NA
parent
6584495be7
commit
fc8d0245bc
11
report.html
11
report.html
|
@ -1544,6 +1544,12 @@ and adapted</em></p>
|
|||
uniqv[which(x == max(x))]
|
||||
}</code></pre>
|
||||
</div>
|
||||
<div id="remove-na" class="section level2" number="2.3">
|
||||
<h2><span class="header-section-number">2.3</span> Remove NA</h2>
|
||||
<pre class="r"><code>removeNA <- function(d){
|
||||
return(d[!is.na(d)])
|
||||
}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div id="load-data" class="section level1" number="3">
|
||||
<h1><span class="header-section-number">3</span> Load Data</h1>
|
||||
|
@ -2392,9 +2398,8 @@ gibt.</p>
|
|||
<div id="selbststudium-2.1" class="section level1" number="6">
|
||||
<h1><span class="header-section-number">6</span> Selbststudium 2.1</h1>
|
||||
<p>We have the year 2021 ## Preparation</p>
|
||||
<pre class="r"><code>birthyears <- litdata$D7
|
||||
# remove NAs
|
||||
birthyears <- birthyears[!is.na(birthyears)]
|
||||
<pre class="r"><code># remove NAs
|
||||
birthyears <- removeNA(litdata$D7)
|
||||
age <- 2021 - birthyears</code></pre>
|
||||
<div id="frequency" class="section level2" number="6.1">
|
||||
<h2><span class="header-section-number">6.1</span> Frequency</h2>
|
||||
|
|
12
report.rmd
12
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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue