First of all, read the help file ?data.frame. What you do is adding a variable row.names, column.names and title to your dataframe. What you want to do is set the rownames and colnames.
> results <- data.frame(matrix(c(1,2,3,4),nrow=2,ncol=2)) > rownames(results) <- c("a","b") > colnames(results) <- c("c","d") > attr(results,"title") <- "aaa" > results c d a 1 3 b 2 4 > str(results) 'data.frame': 2 obs. of 2 variables: $ c: num 1 2 $ d: num 3 4 - attr(*, "title")= chr "aaa" > attr(results,"title") [1] "aaa" If you have the matrix already, take a look at ?as.data.frame. Cheers Joris On Thu, Jun 10, 2010 at 7:22 AM, suman dhara <suman.dhar...@gmail.com> wrote: > Sir, > I want to export the results of R in a data frame. So I want to give > rownames,columnnames & title to the data-frame.I have applied the following: > > > data.frame(matrix(c(...),nrow=,ncol=),row.names=c("a","b"),col.names=c("c","d"),title="aaa") > > But, it does not work. > Can you help me? > > > Regards, > Suman Dhara > > [[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. > -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Applied mathematics, biometrics and process control tel : +32 9 264 59 87 joris.m...@ugent.be ------------------------------- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php ______________________________________________ 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.