楼主: 
mapleV (Sucks)   
2005-03-15 11:05:06※ 引述《untitled (Causality)》之铭言:
: ※ 引述《mapleV (Sucks)》之铭言:
: :         I found a new way to transform usps and it only took 3x seconds.
: !!! How's the CPU of your computer?
        PIII 733Mhz for executing the transformation from loaded data to
        matrix. 3x seconds.
        Loading data takes 8~10 seconds.
: Would you like to share your code with us next Monday?
        I think it's not necessary to show my code next Monday.
        My code is customized for usps data. Not very general.
        Just a simple idea.
        If there exists any errors, please remark it.
        load_transform <- function(filename , ncolumn)
        {
        mdt <- readLines(filename)
        temp <- list()
        for (i in 1: length(mdt))
        temp[[i]] <- as.numeric(matrix(strsplit(mdt[i], " |:")[[1]][2*c(1:ncolumn)-1]))
        dx <- matrix(,ncol = ncolumn ,nrow = length(mdt))
        for (i in 1:length(mdt))
        dx[i,] <- temp[[i]]
        dx
        }