sapply
is returning a matrix
here. You can get the shape and type you want with:
as.data.frame(t(complete("specdata",1:12)))
Or put this in the complete
function, around the call to sapply
. t
transposes the matrix
rows into columns, and as.data.frame
coerces it into such.