複数のデータフレームがありますが、それらはすべて同じ列ヘッダーを持っています。やりたいことは、それらを次々に追加して1つの大きなデータフレームを作成することです。これを行う最善の方法は何ですか。
私は以下を使用しました:しかし、これが正しい方法であるかどうかはわかりません:
append(x, y)
rbind も試しましたが、これらのデータ フレームのサイズの長さが異なるため、予想どおり次のエラーが発生しました。
Error in names(value[[jj]])[ri] <- nm :
'names' attribute [2066] must be the same length as the vector [9]
In addition: Warning message:
In names(value[[jj]])[ri] <- nm :
number of items to replace is not a multiple of replacement length
次に例を示します。
> x
user_id rev_page rev_id rev_parent_id page_ns rev_length delta deleted rev_curr_minor timestamp edit_count lang_level
1 705834 1048946 32026867 30924739 0 2959 82 0 0 2005-12-19 23:21:24 0 N
2 705834 1048946 32028621 32026867 0 3085 126 0 0 2005-12-19 23:36:33 1 N
3 705834 21402 32032828 32027632 0 14395 470 0 0 2005-12-20 00:10:06 2 N
4 705834 21402 32033273 32032828 0 14400 5 0 0 2005-12-20 00:13:50 3 N
5 705834 321528 32065506 29330826 0 3440 201 0 0 2005-12-20 05:13:45 4 N
6 705834 321528 32066086 32065506 0 3525 85 0 0 2005-12-20 05:21:25 5 N
> y
user_id rev_page rev_id rev_parent_id page_ns rev_length delta deleted rev_curr_minor timestamp edit_count lang_level
1 892755 2585151 38515111 24830760 0 2018 1213 0 0 2006-02-06 21:32:26 0 1
2 892755 3807359 63798071 63471532 1 14047 5293 0 0 2006-07-14 15:46:56 1 1
3 892755 3807359 63798564 63798071 1 14146 99 0 0 2006-07-14 15:49:52 2 1
4 892755 2976438 63825832 44108751 0 9609 -60 0 0 2006-07-14 18:38:41 3 1
5 892755 3807359 63891769 63855569 1 15579 1005 0 0 2006-07-15 02:28:59 4 1
6 892755 3807359 67487579 63891769 1 15745 166 0 0 2006-08-03 18:52:01 5 1
> class(x)
[1] "data.frame"
> z <- rbind(x,y)
Error in names(value[[jj]])[ri] <- nm :
'names' attribute [12] must be the same length as the vector [9]
In addition: Warning messages:
1: In names(value[[jj]])[ri] <- nm :
number of items to replace is not a multiple of replacement length
2: In names(value[[jj]])[ri] <- nm :
number of items to replace is not a multiple of replacement length
> rbind(x,y)