[R] simulating data

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun May 11 20:02:36 CEST 2003


Christian Schulz wrote:
> 
> ..for a "unit test"   i need a lot of  rows in my database, so i simulate.
> 
> My problem, using  Win2k,R.1.7.0, 256RAM is that i'm getting memory-erros go about the  1000.000 border , but
> i need bigger test data. Ok is approriate buy more RAM, but is there a possibilty simulate a lot of single rows, one after
> another and between this 2 steps -> Add th row to database and delete them for memory-recover from R ?

In principle, yes. If the memory won't get too segmented it will work, I
think.
Simulating one row after another will certainly result in a huge speed
penalty, but maybe one block of rows after another is the solution you
are looking for.

Uwe Ligges


> Many thanks,Christian
> 
> In example:
> Nachname     <- round(runif(2000000,1,1000000000))
> Vorname      <- round(runif(2000000,1,1000000000))
> PLZ          <- round(runif(2000000,10000,14000))
> VermittlungskriteriumA   <- round(runif(2000000,1,2))
> VermittlungskriteriumB   <- round(runif(200000,1,5))
> klient0 <- cbind(Nachname,Vorname,PLZ,VermittlungskriteriumA,)
> klient <- as.data.frame(klient0)
> rm(klient0)
> klient$VermittlungskriteriumA <- as.factor(klient$VermittlungskriteriumA)
> levels(klient$VermittlungskriteriumA) <- c("MANN","FRAU")
> klient$VermittlungskriteriumB <- as.factor(klient$VermittlungskriteriumB)
> levels(klient$VermittlungskriteriumB) <- c("<3Monate","<6Monate","<12Monate","<18Monate","=>24Monate",)
> 
> library(RODBC)
> channel <- odbcConnect("dsn","root","pass")
> sqlSave(channel,klient)
> 
> ....and more tables
> 
>         [[alternate HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list