[R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Martin Tomko
Dear all, I have a few points that I am unsure about using scan. I know that it is covered in the intro to R, and also has been discussed here: http://www.mail-archive.com/r-help@r-project.org/msg04869.html but nevertheless, I cannot get it to work. I have a potentially very large matrix that

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread peter dalgaard
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

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Martin Tomko
Hi Peter, thank you for your reply. I still cannot get it to work. I have modified your code as follows: rows-length(R) cols - max(unlist(lapply(R,function(x) length(unlist(gregexpr( ,x,fixed=TRUE,useBytes=TRUE)) c-scan(file=f,what=rep(c(list(NULL),rep(list(0L),cols-1),rows-1)), skip=1)

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread baptiste AuguiƩ
Hi, I don't know if this can be useful to you, but I recently wrote a small function to read a large datafile like yours in a number of steps, with the possibility to save each intermediate block as .Rdata. This is based on read.table --- not as efficient as lower-level scan() but it might be

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Martin Tomko
Hi baptiste, thanks a lot. Could you please comment on that code, I cannto figure out what it does. Appart from the file name, what parameters does it need? Seems to me like you need to know the size of the table a priori. Is that right? Do you have to set up the block size depending on that

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread peter dalgaard
On Aug 12, 2010, at 1:34 PM, Martin Tomko wrote: Hi Peter, thank you for your reply. I still cannot get it to work. I have modified your code as follows: rows-length(R) cols - max(unlist(lapply(R,function(x) length(unlist(gregexpr( ,x,fixed=TRUE,useBytes=TRUE)) Notice that the above

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Martin Tomko
Hi Peter, apologies, too fast copying and pasting. So, here is the explanation: f-C:/test/mytab.txt; R-readLines(con=f); where mytab.txt is a table formatted as noted in previous post (space delimited, with header, rownames, containing integers). Now, my understandign of scan was that I have

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Peter Dalgaard
Martin Tomko wrote: Hi Peter, apologies, too fast copying and pasting. So, here is the explanation: f-C:/test/mytab.txt; R-readLines(con=f); where mytab.txt is a table formatted as noted in previous post (space delimited, with header, rownames, containing integers). Now, my

Re: [R] help usin scan on large matrix (caveats to what has been discussed before)

2010-08-12 Thread Martin Tomko
I did. Did not work. Did you try your code? The matrix did not result into integer numbers as expected. MY approach resulted in a correct scan result, at least. M. Martin Tomko wrote: Hi Peter, apologies, too fast copying and pasting. So, here is the explanation: f-C:/test/mytab.txt;