R 基于单独数据帧中的值删除行

R 基于单独数据帧中的值删除行,r,dataframe,indexing,filter,merge,R,Dataframe,Indexing,Filter,Merge,我有一个名为corr_dat_cond1的数据帧,它有一个实验任务的测试 > head(corr_dat_cond1) participant search_difficulty key_resp.corr key_resp.rt target_position distractor1_colour distractor2_colour non_target_colour 1 1010 easy 1 1.186

我有一个名为corr_dat_cond1的数据帧,它有一个实验任务的测试

    > head(corr_dat_cond1)
  participant search_difficulty key_resp.corr key_resp.rt target_position distractor1_colour distractor2_colour non_target_colour
1        1010              easy             1   1.1869998           right          [0,0.5,1]          [0,0.5,1]        [0,0.59,0]
2        1010         difficult             1   1.2490001            down      [0.82,0.31,0]      [0.82,0,0.31]     [0.82,0.31,0]
3        1010              easy             1   1.0100000              up          [0,0.5,1]         [0,0.59,0]        [0,0.59,0]
4        1010              easy             1   0.8659999            down          [0,0.5,1]          [0,0.5,1]        [0,0.59,0]
5        1010         no_search             1   0.8559999           right         [-1,-1,-1]         [-1,-1,-1]        [-1,-1,-1]
6        1010              easy             1   0.6269999           right          [0,0.5,1]         [0,0.59,0]        [0,0.59,0]
  non_target_pos cue_uposition target_char non_target_char cue_time           cue_colour cue_validity
1     [0,-0.328]            up           x               =      1.4 Mismatch (Onset) cue        FALSE
2      [0,0.328]          left           x               =      1.0 Mismatch (Onset) cue        FALSE
3      [0.328,0]          down           x               =      1.1 Mismatch (Onset) cue        FALSE
4      [0.328,0]         right           =               x      1.4    Match (Color) cue        FALSE
5     [-0.328,0]          down           =               x      1.4 Mismatch (Onset) cue        FALSE
6     [0,-0.328]         right           =               x      1.4    Match (Color) cue         TRUE
我的第二个数据帧是cond1_participant_Meants,它在每个搜索难度级别中对每个参与者都有一个高_截止值和低_截止值

    > head(cond1_participant_meanrts)
# A tibble: 6 x 6
# Groups:   participant [2]
  participant search_difficulty   mrt stdev low_cutoff high_cutoff
        <dbl> <chr>             <dbl> <dbl>      <dbl>       <dbl>
1         636 difficult         1.10  0.224     0.426         1.77
2         636 easy              0.986 0.270     0.177         1.79
3         636 no_search         0.909 0.298     0.0160        1.80
4         642 difficult         1.02  0.268     0.221         1.83
5         642 easy              0.887 0.237     0.175         1.60
6         642 no_search         0.809 0.225     0.135         1.48
>负责人(条件参与者指RTS)
#一个tibble:6x6
#分组:参与者[2]
参与者搜索困难mrt stdev低截止高截止
1636难度1.10 0.224 0.426 1.77
2636轻松0.986 0.270 0.177 1.79
3636无搜索0.909 0.298 0.0160 1.80
4642困难1.02 0.268 0.221 1.83
5642轻松0.887 0.237 0.175 1.60
6642无搜索0.809 0.225 0.135 1.48
如果key_resp.rt值大于cond1_participant_Means对应的(基于参与者和搜索难度)high_截止值,或者key_resp.rt值小于cond1_participant_Means对应的low_截止值,我想删除corr_dat_cond1中的行

有办法做到这一点吗?提前谢谢。

这就是你需要的吗

corr_dat_cond1 %>%
    dplyr::left_join(
        cond1_participant_meanrts, by=c("participant", "search_difficulty")
        ) %>%
    dplyr::filter(
        key_resp.rt < high_cutoff | key_resp.rt > low_cutoff
        )
corr\u dat\u cond1%>%
dplyr::左联合(
第1条参与者的意思是,by=c(“参与者”,“搜索难度”)
) %>%
dplyr::过滤器(
按键响应rt<高按键响应rt>低按键响应rt
)

如果您使用
dput(corr\u dat\u cond1)
等包含一些可复制的数据,其他人会更容易回答您的问题。还包括一个示例,其中corr\u dat\u cond1和cond1\u participant\u means具有公共参与者ID将非常有用。