working R array stuff