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
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 wrote:
> library(reshape2)
> mx <- matrix( 1:12, nrow=3 )
> mxdf <- melt( mx )
> names( mxdf
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
This takes away names of all the variables
On Sat, Mar 1, 2014 at 9:30 AM, arun 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
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
wrote:
Hi list
I have a matrix of size m x n (m and n are different, hence non square!)
library(reshape2)
mx <- matrix( 1:12, nrow=3 )
mxdf <- melt( mx )
names( mxdf ) <- c( "m", "n", "value" )
---
Jeff NewmillerThe . . Go Live...
DCN:Basics: ##.#. ##.#. L
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:
7 matches
Mail list logo