(no title)
closed | 3 years ago
I wonder if a challenge for doctests in R is they often have to test larger, more realistic outputs?
For example, in dplyr's mutate doc, one example is this:
starwars %>%
select(name, mass) %>%
mutate(
mass2 = mass * 2,
mass2_squared = mass2 * mass2
)
This example's output is a dataframe with 4 columns and will display first 5 rows.On the other hand in siuba (a port of dplyr to python), I often have to truncate the example output, because it's hard coded in the docstring:
(cars
>> mutate(
cyl2 = _.cyl * 2,
cyl4 = _.cyl2 * 2
)
>> head(2)
)
cyl mpg hp cyl2 cyl4
0 6 21.0 110 12 24
1 6 21.0 110 12 24
It's nice you can see the full example in the docstring in python, but also very handy seeing complex examples on R doc pages:https://dplyr.tidyverse.org/reference/mutate.html#ref-exampl...
No comments yet.