在列的子集上使用pmap

时间:2018-09-14 04:40:55

标签: r purrr

我在一个小标题中有三个列表列:@Override public Bitmap get(String key) { if (key == null) { throw new NullPointerException("key == null"); } Bitmap mapValue; synchronized (this) { mapValue = map.get(key); if (mapValue != null) { hitCount++; return mapValue; } missCount++; } return null; } xleft。很简单,我想知道right的第j个元素是否在xleft的第j个元素之间。这是我到目前为止编写的一些代码:

right

我不断收到错误消息

library(tidyverse)
library(binom)


params = crossing(p = seq(0.05,0.5,0.05), size = 10:100, n = 50)

simulation.results = params %>% 
                      mutate(x = pmap(., rbinom)) %>% 
                      select(-n) %>% 
                      mutate(left = map2(x,size,~binom.agresti.coull(.x,.y)$lower),
                             right = map2(x,size, ~binom.agresti.coull(.x,.y)$upper),
                             coverage = pmap_lgl(list(x = x, left = left, right = right), between) #Problem here
                             )

尽管我确定我使用的语法正确。一个较小的例子似乎起作用

#> Error in mutate_impl(.data, dots): Evaluation error: Expecting a single value: [extent=50]..

如何使用library(tidyverse) x = c(1,2,3) y = c(4,5,6) z = c(2,3,4) pmap_lgl(list(x = x,left = y, right = z), between) #> [1] FALSE FALSE FALSE 确定x的哪些元素在leftright之间?我做错了什么,将来如何避免?

0 个答案:

没有答案