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
Hi,
You didn't provide any reproducible example to start with.
Using Jeff's example
mx - matrix( 1:12, nrow=3 )
dimnames(mx) - list(1:nrow(mx),1:ncol(mx)) ##
setNames(as.data.frame.table(mx),c(m,n,value))
m n value
1 1 1 1
2 2 1 2
3 3 1 3
4 1 2 4
5 2 2 5
6 3 2
Jeff
This works fine for smaller ones but I have a big dataframe. Its ~35000 X
30. When I try this command, it says Using as id variables.
Thank you.
On Sat, Mar 1, 2014 at 12:38 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote:
library(reshape2)
mx - matrix( 1:12, nrow=3 )
mxdf - melt(
On Tue, 4 Mar 2014, Chirag Gupta wrote:
Jeff
This works fine for smaller ones but I have a big dataframe. Its ~35000 X 30.
When I try this command,
it says Using as id variables.
Thank you.
You asked for a solution regarding a matrix. Now you talk about data
frames. And in responding to
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,
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
On 01/03/14 14:49, Chirag Gupta 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
Surely you mean i, j (i = 1, ..., m), j = 1, ..., n).
and cell
value in the original matrix.
Yes:
library(reshape2)
mx - matrix( 1:12, nrow=3 )
mxdf - melt( mx )
names( mxdf ) - c( m, n, value )
---
Jeff NewmillerThe . . Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics:
8 matches
Mail list logo