[R] Finding nrows with specefic values&converting a matrix into a table

abo dalash
2017-04-30T17:17:49Z

Many thanks dear David, your teaching reg. the conversion of a matrix into a
table has resolved my issue and I have now generated the desired table.


So many thanks for your support.


Regards


________________________________
From: David L Carlson <dcarlson at tamu.edu>
Sent: 30 April 2017 07:33 PM
To: abo dalash; r-help at R-project.org
Subject: RE: [R] Finding nrows with specefic values&converting a matrix into
a table

Show us the code you used. Don't just tell us what you did. It is likely
that something you did after creating the matrix converted it to a data frame.
Copy and paste your code to your emails.

> str(mydf)
'data.frame':   3 obs. of  3 variables:
 $ x: int  0 NA NA
 $ y: int  5 0 NA
 $ z: int  67 23 0

> data.frame(as.table(as.matrix(mydf)))
  Var1 Var2 Freq
1    x    x    0
2    y    x   NA
3    z    x   NA
4    x    y    5
5    y    y    0
6    z    y   NA

David C


From: abo dalash [mailto:abo_dlsh at hotmail.com]
Sent: Sunday, April 30, 2017 11:13 AM
To: David L Carlson <dcarlson at tamu.edu>
Subject: Re: [R] Finding nrows with specefic values&converting a matrix into
a table

str(mymatrix)
The Structure shows that this is a 'data.frame'?  of 120 obs. and 120