Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
eesys-public
BIA-Resources
Commits
402ac30c
Commit
402ac30c
authored
Nov 05, 2018
by
Weigert, Andreas
Browse files
added solution for 2nd tutorial
parent
5dad1056
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/BIA_T02_RIntro2.Rmd
View file @
402ac30c
...
...
@@ -54,34 +54,41 @@ summary(Shower_clean) # all rows having NA values in one or many columns are now
```{r Simple Statistics}
# Task 5
mean(Shower$ShowerTime) #mean without parameters does not work because we have some NA values in this vector
mean(Shower_clean$ShowerTime) #this data frame is cleaned and mean should work
mean(Shower$ShowerTime, na.rm = T)
# Task 6
var(Shower_clean$ShowerTime) #variance (implements sample variance)
# Task 7
median(Shower_clean$ShowerTime)
# Task 8
sd(Shower_clean$ShowerTime) #standard deviation (implements sample formula)
# Task 9
#compare variance and square of standard deviation
(sd(Shower_clean$ShowerTime)^2) == var(Shower_clean$ShowerTime)
#the comparison of numbers should be made considering a precision:
all.equal((sd(Shower_clean$ShowerTime)^2), var(Shower_clean$ShowerTime))
# Task 10
max(Shower_clean$ShowerTime)
min(Shower_clean$ShowerTime)
# Task 11
quantile(Shower_clean$ShowerTime)
```
```{r Write and filter data}
# Task 12
write.csv2(x = Shower[Shower$Hh_ID == 8899,], file="../output/problematic_shower_data.csv")
# Task 13
write.csv2(x = Shower[Shower$Hh_ID != 8899,], file="../output/cleaned_shower_data.csv")
```
After cleaning data we have stored the data to the folder "output".
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment