1
私は私のvapplyの私のFUN.VALUEどうあるべきかを見つけるのに苦労しています:vapply fun.value S4
> sapply(ind, function(x) typeof(dataset[[x]]))
[1] "S4"
> sapply(ind, function(x) mode(dataset[[x]]))
[1] "S4"
> sapply(ind, function(x) storage.mode(dataset[[x]]))
[1] "S4"
> sapply(ind, function(x) is(dataset[[x]]))
[,1]
[1,] "PlotSetPair"
[2,] "envRefClass"
[3,] ".environment"
[4,] "refClass"
[5,] "environment"
[6,] "refObject"
[7,] "AssayData"
私は成功せず、次の可能性を試してみました:
> vapply(ind, function(x){return(dataset[[x]]);}, S4)
Error in vapply(ind, function(x) { : object 'S4' not found
> vapply(ind, function(x){return(dataset[[x]]);}, "S4")
Error in vapply(ind, function(x) { : values must be type 'character',
but FUN(X[[1]]) result is type 'S4'
> vapply(ind, function(x){return(dataset[[x]]);}, "S4-class")
Error in vapply(ind, function(x) { : values must be type 'character',
but FUN(X[[1]]) result is type 'S4'
> vapply(ind, function(x){return(dataset[[x]]);}, S4-class)
Error in vapply(ind, function(x) { : object 'S4' not found
> vapply(ind, function(x){return(dataset[[x]]);}, PlotSetPair)
Error in vapply(ind, function(x) { : object 'PlotSetPair' not found
> vapply(ind, function(x){return(dataset[[x]]);}, PlotSetPair())
Error in PlotSetPair() : could not find function "PlotSetPair"
> vapply(ind, function(x){return(dataset[[x]]);}, seqplots::PlotSetPair())
Error: 'PlotSetPair' is not an exported object from 'namespace:seqplots'
> vapply(ind, function(x){return(dataset[[x]]);}, seqplots::PlotSetPair)
Error: 'PlotSetPair' is not an exported object from 'namespace:seqplots'
> vapply(ind, function(x){return(dataset[[x]]);}, PlotSetPair-class)
Error in vapply(ind, function(x) { : object 'PlotSetPair' not found
です解決策がありますか?プリミティブ型でvapplyだけを使用できますか?
おかげ
おそらく関連:https://stackoverflow.com/q/16366739/4996248 –
あなたが非プリミティブ型で 'vapply'を使用することができますが、結果はリストになります。あなたは代わりに 'lapply'を使用するかもしれません。なぜなら、あなたはリストで終わるからです。 – JDL
これは私にとってはうまくいった: 'unlist(vapply(ind、function(x)list(dataset [[x]])、c(new(" PlotSetPair ")))'おかげでたくさん@johnColeman @JDL – nicoluca