Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require(data.table)
- STR.VALS <- c('John, Denver','Michael, Davis','John, Carpenter','Steve, Hopkins','Jena, Malone','Katy, Darabont','Lisa, Minelli','Frank, Johnson',NA,'986188.9999.01')
- DT.CHUNK <- 5*10^7
- DT.FINAL <- 5*10^7
- N.CHUNKS <- DT.FINAL/DT.CHUNK
- APPENDED <- FALSE
- for (ch in seq(1,N.CHUNKS)) {
- DT <- data.table(col1=c(),col2=c(),col3=c(),col4=c())
- DT[,col1 := sample(STR.VALS,DT.CHUNK,replace=TRUE)]
- DT[,col2 := sample(seq(1,20),DT.CHUNK,replace=TRUE)]
- DT[,col3 := sample(LETTERS,DT.CHUNK,replace=TRUE)]
- DT[,col4 := rnorm(DT.CHUNK)]
- fwrite(DT, 'fname.csv', append=APPENDED, col.names=!APPENDED, row.names=TRUE, scipen=9)
- APPENDED <- TRUE
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement