Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不需要任何smart rbind , like rbindlist,rbind.fill和bind_row其他。
rbind
rbindlist
rbind.fill
bind_row
我需要一个笨蛋rbind来简单地绑定两个数据框:
> a <- data.frame(a = 1:3) > b <- data.frame(b = 1:2) > some.magic.bind(a, b) # what function to use here? a b 1 1 1 2 2 2 3 3 NA
你cbind不想rbind。
cbind
尝试 :
a = c(1:3) b = c(1:2) length(b) = length(a) cbind(a, b)
merge直接在两个data.frame不同长度的 s 上工作,并将其保持为data.frame:
merge
data.frame
merge(a,b,by="row.names",all.x=TRUE)[,-1] a b 1 1 1 2 2 2 3 3 NA