列表的输入错误

时间:2016-12-08 14:55:59

标签: r list

我已经厌倦了在这里做个例子how can I manipulate a very large list

我无法弄清楚为什么我的dput总是给出错误。这是dput

my.list<- list(structure(list(check = c(FALSE, FALSE, FALSE, FALSE, FALSE, 
FALSE), myfile = c("", "1xLabel:13C(6)15N(4) [R11]", "1xOxidation [M7]", 
"", "1xLabel:13C(6)15N(4) [R11]", ""), Myname = c("Q9Y383", "Q9Y383", 
"Q9Y383", "Q15366-2", "Q15366-2", "Q15366-2")), .Names = c("check", 
"myfile", "Myname"), row.names = c(NA, -6L), class = c("data.table", 
"data.frame"), .internal.selfref = <pointer: 0x103006b78>), structure(list(
    check = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE
    ), myfile = c(NA, NA, NA, NA, NA, NA, NA), Myname = c("F8W727", 
    "O76021", "P46783", "P35527", "Q96C45", "Q9Y383", "Q9Y383"
    )), .Names = c("check", "myfile", "Myname"), row.names = c(NA, 
-7L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x103006b78>), 
    structure(list(check = c(FALSE, FALSE, FALSE, FALSE, FALSE, 
    FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), myfile = c("", 
    "", "", "", "1xLabel:13C(6)15N(4) [R7]", "", "", "", "3xLabel:13C(6)15N(4) [R1; R7; R10]", 
    "", ""), Myname = c("P61247", "P39019", "Q9NWH9", "P62917", 
    "P62917", "E9PCT1", "Q15149", "Q14152", "Q14152", "Q15020", 
    "Q02543")), .Names = c("check", "myfile", "Myname"), row.names = c(NA, 
    -11L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x103006b78>))

这是错误

  

错误:意外&#39;&lt;&#39; in:&#34; s = c(NA,                                                                                                                                                                                    -11L),class =&#34;

2 个答案:

答案 0 :(得分:1)

删除内部selfref时会在弹出的任何位置将其删除。如果结果列表包含许多实例,则可以使用RStudio中的find-replace功能。有关为何发生这种情况的更多信息See this question

list(structure(list(check = c(FALSE, FALSE, FALSE, FALSE, FALSE, 
                                        FALSE), myfile = c("", "1xLabel:13C(6)15N(4) [R11]", "1xOxidation [M7]", 
                                                           "", "1xLabel:13C(6)15N(4) [R11]", ""), Myname = c("Q9Y383", "Q9Y383", 
                                                                                                             "Q9Y383", "Q15366-2", "Q15366-2", "Q15366-2")), .Names = c("check", 
                                                                                                                                                                        "myfile", "Myname"), row.names = c(NA, -6L), class = c("data.table", 
                                                                                                                                                                                                                               "data.frame")), structure(list(
                                                                                                                                                                                                                                 check = c(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE
                                                                                                                                                                                                                                 ), myfile = c(NA, NA, NA, NA, NA, NA, NA), Myname = c("F8W727", 
                                                                                                                                                                                                                                                                                       "O76021", "P46783", "P35527", "Q96C45", "Q9Y383", "Q9Y383"
                                                                                                                                                                                                                                 )), .Names = c("check", "myfile", "Myname"), row.names = c(NA, 
                                                                                                                                                                                                                                                                                            -7L), class = c("data.table", "data.frame")), 
               structure(list(check = c(FALSE, FALSE, FALSE, FALSE, FALSE, 
                                        FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), myfile = c("", 
                                                                                              "", "", "", "1xLabel:13C(6)15N(4) [R7]", "", "", "", "3xLabel:13C(6)15N(4) [R1; R7; R10]", 
                                                                                              "", ""), Myname = c("P61247", "P39019", "Q9NWH9", "P62917", 
                                                                                                                  "P62917", "E9PCT1", "Q15149", "Q14152", "Q14152", "Q15020", 
                                                                                                                  "Q02543")), .Names = c("check", "myfile", "Myname"), row.names = c(NA, 
                                                                                                                                                                                     -11L), class = c("data.table", "data.frame")))

# [[1]]
#   check                     myfile   Myname
# 1 FALSE                              Q9Y383
# 2 FALSE 1xLabel:13C(6)15N(4) [R11]   Q9Y383
# 3 FALSE           1xOxidation [M7]   Q9Y383
# 4 FALSE                            Q15366-2
# 5 FALSE 1xLabel:13C(6)15N(4) [R11] Q15366-2
# 6 FALSE                            Q15366-2
# 
# [[2]]
#   check myfile Myname
# 1 FALSE     NA F8W727
# 2 FALSE     NA O76021
# 3 FALSE     NA P46783
# 4 FALSE     NA P35527
# 5 FALSE     NA Q96C45
# 6 FALSE     NA Q9Y383
# 7 FALSE     NA Q9Y383
# 
# [[3]]
#    check                             myfile Myname
# 1  FALSE                                    P61247
# 2  FALSE                                    P39019
# 3  FALSE                                    Q9NWH9
# 4  FALSE                                    P62917
# 5  FALSE          1xLabel:13C(6)15N(4) [R7] P62917
# 6  FALSE                                    E9PCT1
# 7  FALSE                                    Q15149
# 8  FALSE                                    Q14152
# 9  FALSE 3xLabel:13C(6)15N(4) [R1; R7; R10] Q14152
# 10 FALSE                                    Q15020
# 11 FALSE                                    Q02543

答案 1 :(得分:0)

如果你删除了最后一行中.internal.selfref的{​​{1}}部分,它就有效:

dput