R和XML:';下标越界';错误

R和XML:';下标越界';错误,r,xml,R,Xml,我做错了什么?我的R代码: u <- "http://www.cbr.ru/scripts/xml_depo.asp?date_req1=01/07/2001&date_req2=22/12/2020" f <- xml2::read_xml(u) doc <- xml2::as_list(f) d <- lapply(doc$Deposit, function(x) data.frame(Overnight = x$Ove

我做错了什么?我的R代码:

u <- "http://www.cbr.ru/scripts/xml_depo.asp?date_req1=01/07/2001&date_req2=22/12/2020" 
f <- xml2::read_xml(u)
doc <- xml2::as_list(f)
d <- lapply(doc$Deposit, 
        function(x) data.frame(Overnight = x$Overnight[[1]],
                               Tom_next = x$`Tom-next`[[1]],
                               Spot_next = x$`Spot-next`[[1]],
                               Spot_week = x$`Spot-week`[[1]],
                               P2weeks = x$P2weeks[[1]],
                               Spot_2week = x$`Spot-2week`[[1]],
                               P1month = x$P1month[[1]],
                               P3month = x$P3month[[1]],
                               Date = attr(x, "Date")))
d <- dplyr::bind_rows(d)

u我认为你应该改变
d我认为你应该改变
d谢谢!我确实这样做了
d摘要(d)长度类模式过夜0 data.frame list…
很抱歉我太匆忙了。我编辑了我的答案。希望它能起作用。非常感谢!这很有帮助!很乐意帮忙。请考虑接受我的回答,谢谢!我确实这样做了
d摘要(d)长度类模式过夜0 data.frame list…
很抱歉我太匆忙了。我编辑了我的答案。希望它能起作用。非常感谢!这很有帮助!很乐意帮忙。请考虑接受我的回答。
d <- lapply(doc$Deposit$Record, 
        function(x) data.frame(Overnight = x$Overnight[[1]],
                               Tom_next = x$`Tom-next`[[1]],
                               Spot_next = x$`Spot-next`[[1]],
                               Spot_week = x$`Spot-week`[[1]],
                               P2weeks = x$P2weeks[[1]],
                               Spot_2week = x$`Spot-2week`[[1]],
                               P1month = x$P1month[[1]],
                               P3month = x$P3month[[1]],
                               Date = attr(x, "Date")))
d <- dplyr::bind_rows(d)
d <- lapply(doc$Deposit$Record, cbind)
d <- as.data.frame(t(unlist(d)))
d
# Overnight Tom-next Spot-next P1week Spot-week P2weeks Spot-2weeks P1month P3month
# 1         2      2,3       2,5      7       7,5     8,5           9      10      12