Suppose df is a dataframe with one named row of numeric observations. I want to coerce df into a named vector.
as.vector does not work as I expected: as.vector(df) returns the original dataframe, while as.vector(df,mode="numeric") returns an unnamed vector of NAs. This works: > v <- as.numeric(as.matrix(df)); names(v) <- names(df); I just wanted check if there was a better/more natural way of doing this? [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.