次のデータ フレームに ddply を適用しています。ポイントは、同じ国を持つ行に yearly_test_count 値に ecdf 関数を適用することです。
> head(test)
country yearly_test_count download_speed
1 AU 1 2.736704
2 AU 6 3.249486
3 AU 6 2.287267
4 AU 6 2.677241
5 AU 6 1.138213
6 AU 6 3.205364
これは私が使用したスクリプトです:
house_total_year_ecdf <- ddply(test, c("country"), mutate,
ecdf_val = ecdf(yearly_test_count)(yearly_test_count)*length(yearly_test_count))
しかし、次のエラーを受け取りました。
Error in eval(substitute(expr), envir, enclos) :
object 'yearly_test_count' not found
================================================== ================
yearly_test_count 列で関数 ecdf を単独で使用してみましたが、機能します。
ecdf(test$yearly_test_count)(test$yearly_test_count)*length(test$yearly_test_count)
ddply を使用しているときにこれが機能しない理由を知っている人はいますか?
スクリプトは以前は機能していたので、これは奇妙です。スクリプトを再度実行すると、前述のエラーが発生します。この問題が R のバージョンまたはパッケージのバージョンの違いに関連しているかどうかはわかりませんか?
どんな助けでも大歓迎です!:)