as.vector function updated @vjovanov