Chuck Cleland wrote: > On 2/23/2008 6:09 AM, Chuck Cleland wrote: >> On 2/22/2008 8:01 PM, Robert Walters wrote:
Chuck, Thanks for the pointers on subset(). When I submit the two variants you suggested, below: > fit1 <- lm(y ~ x, subset(data.b, porosity == "macro")) Error in eval(expr, envir, enclos) : object "porosity" not found > fit1 <- lm(pore.pct ~ Db, data.b[data.b$porosity=="macro",]) Error in lm.fit(x, y, ...) : 0 (non-NA) cases So, the problem is there are no objects defined for data.b, as confirmed by the following query: > objects() [1] "data.a" "data.a0" "data.b" > objects(data.b) Error in as.environment(pos) : invalid object for 'as.environment' However, when I submit the following queries: > names(data.b) [1] "system" "block" "position" ... > levels(data.b$porosity) [1] "macro " "micro" > print(data.b$porosity) [1] macro... [26] micro... [51] macro... [76] micro... R returns values in each instance. Therein lies my confusion. Furthermore,I can plot data.b with xyplot(), a very nice coplot is produced. Any thoughts? Robert ______________________________________________ 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.