[R] S4 Class to Array

Glenn Schultz glennmschultz at me.com
Wed Dec 16 16:45:42 CET 2015

Hello All,

I would like to be able to convert and S4 class to an array but I seem to be stuck.  Reading the documentation I think I need to use setAs() and then as() Below is a minimal example but I cannot get it to work.  So I am doing something wrong but I don't know what it is.

Any insights/help are appreciated,
- Glenn

dataone = "numeric",
datatwo = "numeric"))

FillObject <- function(){
one <- rep(10, 20)
two <- rep(10,20)

dataone = one,
datatwo = two)

MyObject <- FillObject()

setAs(from = "AnObject" , to = "array", def = function(from) from(AnObject))

NewObject <- as(MyObject, "array")

More information about the R-help mailing list