--- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote: > If I have two vectors > X<-1:10 > Y<-1:5 > When I combine them using cbind, the shorter one is > repeated and both are made of the same length. Is > there a methods that does this without duplicating > the shorter one. I want to use this to store the > data back to a file. > Thanks ../Murli >
It's not quite clear what you want to do. If you just want to save an .Rdata file you could just put the variables in a list. X<-1:10 Y<-1:5 mylist <-list(X,Y) If you want to save to something like a data.frame to a csv file then you probably need to add some padding to the file. The function below adds NA's and turns the matrix into a data.frame padding <- function(a,b) { zz <-rep(NA,length(X)-length(Y)) YY <- c(Y,zz) out <- data.frame(cbind(a,YY)) } dd <- padding(X,Y) ______________________________________________ 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.