On Mon, Jun 13, 2011 at 4:45 PM, Barry Rowlingson
<b.rowling...@lancaster.ac.uk> wrote:
> On Mon, Jun 13, 2011 at 11:06 AM, Aparna <aparna.sampat...@gmail.com> wrote:
>> Hi All
>>
>> I am new to R and  I am not sure of how this should be done. I have a matrix 
>> of
>> 985x100 values and the class is data.frame.
>
>  You don't have a 'matrix' in the R sense of the word. You seem to
> have a table of numbers which are stored in an object of class
> 'data.frame'.
>

but you could have one:

a <- data.frame(matrix(rnorm(100),10) # get some data
class(a) # check for its class
as.numeric(a) # whoops, won't work

class(as.matrix(a)) # change class, and
as.numeric(as.matrix(a)) # bingo, it works

PF


-- 
+-----------------------------------------------------------------------
| Patrizio Frederic,
| http://www.economia.unimore.it/frederic_patrizio/
+-----------------------------------------------------------------------

______________________________________________
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