On Aug 12, 2010, at 11:30 AM, Martin Tomko wrote:

> 
> c<-scan(file=f,what=list(c("",(rep(integer(0),cols)))), skip=1)
> m<-matrix(c, nrow = rows, ncol=cols,byrow=TRUE);
> 
> for some reason I end up with a character matrix, which I don't want. Is this 
> the proper way to skip the first column (this is not documented anywhere - 
> how does one skip the first column in scan???). is my way of specifying 
> "integer(0)" correct?

No. Well, integer(0) is just superfluous where 0L would do, since scan only 
looks at the types not the contents, but more importantly, what= wants a list 
of as many elements as there are columns and you gave it 

> list(c("",(rep(integer(0),5))))
[[1]]
[1] ""

I think what you actually meant was

c(list(NULL),rep(list(0L),5))



> 
> And finally - would any sparse matrix package be more appropriate, and can I 
> use a sparse matrix for the image() function producing typical heat,aps? I 
> have seen that some sparse matrix packages produce different looking outputs, 
> which would not be appropriate.
> 
> Thanks
> Martin
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
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