如何将表绑定到列中(How to bind table into columns)
我有下表delete :
complete creditcheck disclosure getduedates package payment probing serviceability 1 2 3 3 2 2 1 1如何将这些列添加到我的数据框data_frame ?
假设data_frame与data_frame具有相同的行数。
I have the following table delete:
complete creditcheck disclosure getduedates package payment probing serviceability 1 2 3 3 2 2 1 1How do I add these columns, as they appear, to my data frame data_frame?
Assume that data_frame has the same number of rows as delete.
最满意答案
尝试
library(dplyr) bind_rows(df1, as.data.frame.list(delete)) # Source: local data frame [4 x 3] # A B C #1 1 4 7 #2 2 5 8 #3 3 6 9 #4 10 10 10如果您需要使用现有列来“删除”
bind_cols(df2, as.data.frame.list(delete)) # V1 V2 V3 A B C #1 1 2 3 10 10 10数据
df1 <- data_frame(A=1:3, B=4:6, C=7:9) b <- factor(rep(c("A","B","C"), 10)) delete <- table(b) df2 <- data_frame(V1= 1, V2=2, V3=3)Try
library(dplyr) bind_rows(df1, as.data.frame.list(delete)) # Source: local data frame [4 x 3] # A B C #1 1 4 7 #2 2 5 8 #3 3 6 9 #4 10 10 10If you need to cbind the 'delete' with the existing columns
bind_cols(df2, as.data.frame.list(delete)) # V1 V2 V3 A B C #1 1 2 3 10 10 10data
df1 <- data_frame(A=1:3, B=4:6, C=7:9) b <- factor(rep(c("A","B","C"), 10)) delete <- table(b) df2 <- data_frame(V1= 1, V2=2, V3=3)更多推荐
data_frame,delete,serviceability,probing,电脑培训,计算机培训,IT培训"/> <meta
发布评论