fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

June Choe

A student in my intro class taught me something new today (by way of a cryptic "bug").

Suppose you're asked why this {purrr} code that should return the mean of each list element is not working as expected.

```
map(list(x=1:3, y=4:6), mean)
#> $x
#> [1] 1
#>
#> $y
#> [1] 4
```

What do you think is the simplest explanation for this behavior (in terms of the mistake that the student could've made)? It's not so obvious - there are multiple R "quirks" cascading!

Answer is in the images!