simpr icon indicating copy to clipboard operation
simpr copied to clipboard

`fit()` ignores unnamed arguments and repeated arguments

Open statisfactions opened this issue 3 years ago • 0 comments

Ignores unnamed arguments:

library(simpr)
#> 
#> Attaching package: 'simpr'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
specify(a = ~ 1:10) %>% 
  generate(1) %>% 
  fit(~ mean(a))
#> full tibble
#> --------------------------
#> # A tibble: 1 × 3
#>   .sim_id   rep sim              
#>     <int> <int> <list>           
#> 1       1     1 <tibble [10 × 1]>
#> 
#> sim[[1]]
#> --------------------------
#> # A tibble: 10 × 1
#>        a
#>    <int>
#>  1     1
#>  2     2
#>  3     3
#>  4     4
#>  5     5
#>  6     6
#>  7     7
#>  8     8
#>  9     9
#> 10    10

Created on 2022-02-01 by the reprex package (v2.0.1)

Ignores repeated arguments:

library(simpr)
#> 
#> Attaching package: 'simpr'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
specify(b = ~ 1:10) %>% 
  generate(1) %>% 
  fit(b = ~ mean(b),
      b = ~ sd(b))
#> full tibble
#> --------------------------
#> # A tibble: 1 × 4
#>   .sim_id   rep sim               b        
#>     <int> <int> <list>            <list>   
#> 1       1     1 <tibble [10 × 1]> <dbl [1]>
#> 
#> sim[[1]]
#> --------------------------
#> # A tibble: 10 × 1
#>        b
#>    <int>
#>  1     1
#>  2     2
#>  3     3
#>  4     4
#>  5     5
#>  6     6
#>  7     7
#>  8     8
#>  9     9
#> 10    10
#> 
#> b[[1]]
#> --------------------------
#> [1] 5.5

Created on 2022-02-01 by the reprex package (v2.0.1)

statisfactions avatar Feb 01 '22 23:02 statisfactions