Re: [R] question about converting a matrix to a dataframe

2010-09-16 Thread Ivan Calandra
Hi, Well, it works for me: x <- matrix(1:20, nrow=5, ncol=4) data.frame(x[1:5,2:4]) X1 X2 X3 1 6 11 16 2 7 12 17 3 8 13 18 4 9 14 19 5 10 15 20 Maybe with as.data.frame(), or set the drop argument to FALSE: data.frame(x[1:5,2:4,drop=FALSE]) Not sure why it doesn't work for you. Check t

Re: [R] question about converting a matrix to a dataframe

2010-09-16 Thread Michael Green
Use as.data.frame instead. It does what you want it to do. newdata.df<-as.data.frame(stocks1[1:5,2:5]) Cheers, Michael -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Leigh E. Lommen Sent: 16. september 2010 17:18 To: r-help@r-proj