0

我有一个data.frame:

1    2    3    4
A    B    C    D
A    B    C <NA>
A    C    D <NA>
A    C <NA> <NA>
A    D <NA> <NA>
A    E    G <NA>
A    G <NA> <NA>
A    K <NA> <NA>
A    D    J    P

上面的 data.frame 表示这些序列:

Sequence    Is this Non-subsequence?
A-B-C-D     (non-subsequence)
A-B-C       (subsequence of A-B-C-D)
A-C-D       (subsequence of A-B-C-D)
A-C         (subsequence of A-B-C-D)
A-D         (subsequence of A-B-C-D)
A-E-G       (non-subsequence)
A-G         (subsequence of A-E-G)
A-K         (non-subsequence)
A-D-J-P     (non-subsequence)

我只想提取这样的非子序列:

1    2    3    4
A    B    C    D
A    E    G
A    K
A    D    J    P

是否可以提取不是任何其他序列的子序列的序列?

PS。这是制作第一个data.frame的代码。

data.frame(rbind(
        c('A','B','C','D'),
        c('A','B','C', NA),
        c('A','C','D', NA),
        c('A','C',NA,NA),
        c('A','D',NA,NA),
        c('A','E','G',NA),
        c('A','G',NA,NA),
        c('A','K',NA,NA),
        c('A','D','J','P')))
4

0 回答 0