I am so happy about learning how to read in multiple Excel files, that I have
to try and make another improvement. I know what I have been doing is
clumsy, but it works. Hopefully, someone can suggest a more elegant
solution. As a novice, I have been using MS-Word and mail merge to write my
code. I start with about 2 pages of code, and end up with 2,220 merged pages
that I copy and paste into R. You can probably guess that I am not a
programmer.

## here is the start of my merge document. The "x116" line has the merge
field, in this case "Bases-K Ammonium Acetate-2008-116". This changes for
each soil sample, and for each type of analysis. ##

napt <- read.table(file = "C:/Documents and Settings/jfloren/My
Documents/R_Statistics/NAPT/NAPT_09/CertIn2010/Data_for_R/readin_all_for_2010_cert.csv
", header = TRUE, sep = ",")
attach(napt)

x116 <- subset(napt, Analysis_Soil %in% c("Bases-K Ammonium
Acetate-2008-116"))

detach(napt)
attach(x116)

#### End of merge document section for selecting the subset  ###

Once I get the subset isolated, I have no problems calculating the necessary
statistics and can generate some wonderful graphs. 

I have two questions. 
1. How do I select different subsets from a large table without resorting to
using Word's Mail Merge?
2. I prefer to only analyze the results if at least nine labs submitted
results for a particular test. How would I tell R to skip the analysis if
the number of labs running a particular test is less than nine?

Thanks,

Jerry Floren
Minnesota Department of Agriculture


-- 
View this message in context: 
http://n4.nabble.com/Help-with-subset-tp1049883p1049883.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

Reply via email to