0

I have a dataset that contains about 9 million obs across 241 variables. So to avoid stress on the system, I tried to breakdown into chunks of a million each and then looping it.

chunksize <- 1000000

index <- 0
repeat {
    index <- index + 1
    print(paste("Processing rows:", index * chunksize))
    if(n_max(df) != chunksize){
        print('Processed all files!')
        break}
    df <- read_sav("filename.zsav", n_max = chunksize)
    break
}

However, this does not work and shows error: could not find function "n_max". Any ideas about how to loop in haven>

0 Answers0