I'm using R 1.6.2 on Windows 2000. I have two similar sets of files in two different directories. One contains species presence data and environmental measurements; the other contains species absence data and environmental measurements for the same variables as the presence data.
The absence datasets contain many more observations than the presence datasets, and I'd like to draw a random sample from these larger datasets upon import of the text files. I would also like to condition the import so that I only draw rows whose column(s) satisfy a criteria, e.g. where data$temp <= 0. However, I'm not seeing anyway of doing this. I know I can use something like: > test <- read.table(file="10.06.94ed.txt",header=T) > test2 <- test[test$temp>15,] > test2[sort(sample(10)),] but can I do this as I read in the file? If yes, how could I find the # of lines in my smaller file, and then pass that number to the sample call on the larger file? (Is there a wc -l equivalent in R?) Finally, if yes to either of the above, is there a way to batch this? -- Rob Schick Ecologist NOAA Fisheries Santa Cruz Lab 110 Shaffer Road Santa Cruz, CA 95060 Phone: 831.420.3960 ______________________________________________ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help