[R] error in casting matrix

Erik Iverson iverson at biostat.wisc.edu
Wed Jun 18 01:23:07 CEST 2008



Paul Adams wrote:
> Hello everyone,
> I am trying to cast a data frame to a matrix I have used the 
> following code:
> dat<-read.table(file="C:\\Documents and Settings\.....txt",header=T,row.names=1)
> file.show(file="C:\\Documents and Setting....t.txt")
> Z.matrix<-as.matrix(dat.data.frame)
> but I keep getting the error
> error in as.matrix(dat.data.frame):
> object dat.data.frame not found
> What am I doing wrong?

You are assigning the data.frame returned from read.table to an object 
named 'dat'.   So why are you trying to use an object called 
'dat.data.frame' in your call to as.matrix.

Just do as.matrix(dat) if this is what you really want to do.


> Thank You 
> Paul
> 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list