or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
![image alt](https:// "title") | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | Emoji list | ||
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing
xxxxxxxxxx
INBO CODING CLUB
28 May 2020
Welcome!
Share your code snippet
If you want to share your code snippet, copy paste your snippet within a section of three backticks (```):
As an example:
(you can copy paste this example and add your code further down)
Deelnemers
No yellow sticky notes online. Put your name + " | " and add a "*" each time you solve a challenge.
Challenge 1
Damiano's solution:
Anja:
for (i in 1:ncol(swiss)){
j <- mean(swiss[,i])
print(j)
}
for (i in 1:ncol(iris)){
j <- typeof(iris[,i])
print(j)
}
for (i in seq_along(iris)){
j <- length(unique(iris[[i]]))
print(j)
}
distr <- c(-10, 0, 10, 100)
for (i in distr){
j <- rnorm(n = 10, mean = i)
print(j)
}
Salva's solution (using sapply instead of for loops)
Pieterjan's solution on unique values using n_distinct() (from the tidyverse package) instead of unique()
Challenge 2
Karen's solution:
years <- seq.int(2010, 2019)
for (year in years) {
year_births_plot <-
births %>%
filter(year == year) %>%
ggplot() +
geom_col(mapping= aes(x = month, y = n_births)) +
ylab("Number of births") +
coord_flip() +
ggtitle(paste0("Number of births", year))
year_births_plot + ggsave(filename = paste0("./n_births_belgium_", year, ".png"), year_births_plot, device = "png")
}
Salva's solution:
Intermezzo - Dice game
Salva: I have added a bit of interactivity to the game :)
Challenge 3
Anja (simpele benadering …)
part 1
Joost
part 2
Joost