を考慮するために、データセットの操作:私はに取得する方法を見つけ出す必要があり考えると反復測定
df <- data.frame(
CompanyID=c("Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers"
,"Drinkers","Drinkers", "Liquders","Liquders","Liquders","PelletCoffeeCo","PelletCoffeeCo"),
Email= c("[email protected]", "[email protected]","[email protected]","[email protected]", "[email protected]",
"[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]",
"[email protected]","[email protected]","[email protected]","[email protected]",
"[email protected]"),
Day= c("1","2","3","4","5","6","7","8","9","10","1","2","3","1","2"),
var1= c(4,5,5,5,2,3,2,7,6,5,7,6,6,2,3))
を:
df2 <- data.frame(CompanyID=c("Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers","Drinkers"
,"Drinkers","Drinkers", "Liquders","Liquders","Liquders","Liquders","Liquders","Liquders",
"Liquders","Liquders","Liquders","Liquders", "PelletCoffeeCo","PelletCoffeeCo","PelletCoffeeCo",
"PelletCoffeeCo","PelletCoffeeCo","PelletCoffeeCo","PelletCoffeeCo","PelletCoffeeCo",
"PelletCoffeeCo","PelletCoffeeCo"),
Email= c("[email protected]", "[email protected]","[email protected]","[email protected]", "[email protected]",
"[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]",
"[email protected]","[email protected]","[email protected]","[email protected]","[email protected]",
"[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]",
"[email protected]","[email protected]","[email protected]","[email protected]",
"[email protected]","[email protected]","[email protected]","[email protected]",
"[email protected]"),
Day= c("1","2","3","4","5","6","7","8","9","10","1","2","3","4","5","6","7","8","9","10",
"1","2","3","4","5","6","7","8","9","10"),
var1= c(4,5,5,5,2,3,2,7,6,5,7,6,6, NA,NA,NA,NA,NA,NA,NA, 2,3,NA,NA,NA,NA,NA,NA,NA,NA))
説明: 私は私が終わっ一日一回人を調査したデータを持っています10日間のコース。完璧な世界では、私はday1:day10と表記される各参加者からの10の応答を持っています。しかし、無回答のため、参加者の中には3つの回答があり、他の人は6人、他は10人などでした。私は成長モデルを実行するためにデータを設定しています。したがってDay1 - 10日目。これらの回答のデータがあるかどうかは関係ありません。私は10日分のデータを持たない行にNAを追加することでこれを実証しようとしました。
どうすればいいですか?
ありがとうございました!
恐ろしい!ありがとうございます。それは魅力のように働いた。 他の変数x1:x10がいくつかありますが、同じように動作することを期待しています。 機能を説明できますか?どのように動作するのか分かりますが、どのように完全でネスティングがうまく機能するのかわかりません。なぜ、最後にdata.frameの引数を追加する必要があるのですか? – D500
@ D500 - 問題ありません。上記の説明を参照してください。 – www