In case anyone with a similar need comes across this thread, I am posting below a solution to my problem, in which I construct a new data frame that has the desired dimensions, instead of trying to change the dimensions of the existing data frame.
<code> npt <- length(pt) # Step through each variable. data.names <- names(x$data) data.new <- as.data.frame(array(NA, dim=c(npt, dim(x$data)[2]))) names(data.new) <- data.names for (datum.name in data.names) { if (datum.name != "pressure") { data.new[[datum.name]] <- approx(x$data[["pressure"]], x$data[[datum.name]], pt)$y } } # Now replace pressure data.new[["pressure"]] <- pt res$data <- data.new </code> -- View this message in context: http://www.nabble.com/how-to-shorten-elements-in-a-data-frame--tp14296509p14297847.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.