Try: as.vect = function(x) { t1 = as.matrix(x) t2 = aperm(t1) t3 = as.vector(t2) return(t3) } This function converts entire dataframe into a vector. Alexander Pui PhD Candidate in Hydroclimatology, University of New South Wales Email: a.pui at student.unsw.edu.au