# for loop to calculate the median of every column in mtcars
<- vector("double", ncol(mtcars))
output for (i in seq_along(mtcars)) {
<- median(mtcars[[i]])
output[[i]]
}# see the output
output
# same as above using a map() function
map_dbl(mtcars, median)
UQRUG 22
meeting
2021-11-15: UQRUG 22
Attendees
- Catherine: Biology/Library, publish data for a paper
- Grechel: PhD candidate/ PACE temporal trend analysis
- Siu: Bachelor of Biomedical Science
- Einat: PhD candidate / Civil Engineering School
Code snippets
Example of for loop vs map() function from purrr package.