How to convert a CSCmatrix or dgCMatrix into dataframe?

dataframe

#1

Can we convert CSCmatrix or dgCMatrix into dataframe ? i read many forum pages .but couldnt understand, Can anyone help me with this ?

class(objTrain_hashed)
[1] “CSCMatrix”

Thanks,
Rohit

@Lesaffrea @shuvayan @hinduja1234 @Aarshay


#2

Hi Rohit

How are you doing so look the coerce description :slight_smile: so now I have m as dgCmatrix and I do

as.data.frame(as.matrix(m)) and you got it :slight_smile: coerce first to matrix

Have fun

Alain


#3

Hi Alain,

Thanks fr the solution… Problem Solved :slight_smile: :slightly_smiling:

Thanks,
Rohit