This takes away names of all the variables

On Sat, Mar 1, 2014 at 9:30 AM, arun <smartpink...@yahoo.com> wrote:

>
>
> Hi,
> You could try:
> #If mat1 is the matrix
> dimnames(mat1) <- list(1:nrow(mat1),1:ncol(mat1))
> setNames(as.data.frame.table(mat1),c("m","n","value"))
> A.K.
>
>
> On Friday, February 28, 2014 11:40 PM, Chirag Gupta <cxg...@email.uark.edu>
> wrote:
> Hi list
>
> I have a matrix of size m x n (m and n are different, hence non square!)
> I want to melt it in such a way that I get a df of 3 columns. m ,n and cell
> value in the original matrix.
>
> Any suggestions?
>
> --
> *Chirag Gupta*
> Department of Crop, Soil, and Environmental Sciences,
> 115 Plant Sciences Building, Fayetteville, Arkansas 72701
>
>     [[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.
>
>


-- 
*Chirag Gupta*
Department of Crop, Soil, and Environmental Sciences,
115 Plant Sciences Building, Fayetteville, Arkansas 72701

        [[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.

Reply via email to