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
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
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)
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
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
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
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
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
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;
9 matches
Mail list logo