Dear R users, I have a SAS codes with several loops in it, and i hope to use R to do the same task. The SAS codes are as follows, /*to generate the dataset*/ DATA Single_Simulation; DO se=0 to 1 by 0.01; DO sp=0 to 1 by 0.01; DO DR=0 to 1 by 0.01; TR=(DR+sp-1)/(se+sp-1+1.0e-12); Adjust_Factor=TR/(DR+1.0e-12); OUTPUT; END; END; END; RUN;
/*to select some data*/ DATA sampledata; SET Single_Simulation; IF DR=0.02 & sp=1; RUN; #I tried the following codes with R,failed num<-seq(0, 1, by = 0.01) for (se in num) { for (sp in num) { for (DR in num) { TR=(DR+sp-1)/(se+sp-1+1.0e-12) Adjust_Factor=TR/(DR+1.0e-12) } } } My questions are, 1. What is the correct codes for R to do the similar task? 2. Sometimes, the simulated dataset are very large, so i need to put the generated dataset in a file with large disk place, not in the memory, how to do it? SAS can do it with the 'libname' argument, do R have the similar method? Thanks a lot. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.