2011-10-28 1 views
1

クラスitemに関数length()を使用して、ベクトルoptionsの長さを明らかにしようとしています。新しいクラスにlength()を使用するR

setClass(Class = "item", 
    representation = representation(
    options = "character" 
), 
    prototype = prototype(
    options = character() 
) 
) 
setGeneric("length") 
setMethod("length", signature(x = "item"), definition = function(x) length([email protected])) 

しかし、私はいつも次のエラーを取得する:

Error: could not find function "getGeneric" 
Warning: 
In .rk.get.structure.global(".__C__item") : 
    failure to get object .__C__item 

私はRKWardバージョン0.5.7z + 0.5.8 + devel1でR version 2.13.2 (2011-09-30)を使用しています。

+0

を呼び出し –

+0

OK、RKWardバージョン0.5.7z + 0.5.8は+ devel1に問題があるように思われます。プレーンなRシェルでは、コードは難なく実行されます。 – woobert

+0

'methods :: setGeneric' /' methods :: setMethod'、RKWardがあまりにも巧妙だったので? –

答えて

1

既定では、methodsパッケージは起動時に読み込まれません。それは、(R 2.13.1)それは私のために正常に動作し、奇妙だ

library(methods) 
+1

hm、それは違いをもたらさなかった – woobert

+0

@woobertそれは有線です。私も同じ状況ですが、これは私のために働きます。 –

関連する問題