tidyverse / purrr

A functional programming toolkit for R
https://purrr.tidyverse.org/
Other
1.27k stars 274 forks source link

Error in the doc for `list_modify()` #1053

Closed DanChaltiel closed 1 year ago

DanChaltiel commented 1 year ago

In the doc https://purrr.tidyverse.org/reference/list_modify.html, an example is wrong:

image

Obviously, the correct output is:

library(tidyverse)
x <- list(x = 1:10, y = 4, z = list(a = 1, b = 2))
str(list_modify(x, z = zap()))
#> List of 2
#>  $ x: int [1:10] 1 2 3 4 5 6 7 8 9 10
#>  $ y: num 4

Created on 2023-01-31 with reprex v2.0.2

Tested with purrr version 1.0.1, sorry if it is corrected in the dev (I cannot install it now for an obscure local proxy reason).

hadley commented 1 year ago

That's because the current doc file is https://purrr.tidyverse.org/reference/list_assign.html, and that file exists due to a limitation in our pages deploy workflow that we haven't yet figured out how to overcome.