Skip to content

problem with white space

1 message · jim holtman

#
How long is it taking?  Can you send me the code that you are using.

Another technique is to recode you characters into numbers and store
them as integers.  You can then sample the values and reconstruct the
output.  Here is a faster way:

# create some test data -- might be read in the readLines
# use 'raw' class for the data.
sdata <- sapply(1:10, function(x){
    charToRaw(paste(sample(LETTERS, 50, TRUE), collapse=""))    #
encode the character as a number
})
# now create 10 sample of size 20 and write in files
for (i in 1:10){
    x <- sample(sdata, 100000, TRUE)
    # convert back to characters
    writeLines(rawToChar(x), con=paste("file", i, sep=''))
}






On Sun, Mar 30, 2008 at 6:06 PM, Suraaga Kulkarni
<suraaga.kulkarni at gmail.com> wrote: