Re: [R] using subset() in data frame

2008-02-23 Thread Chuck Cleland
On 2/22/2008 8:01 PM, Robert Walters wrote: R folks, As an R novice, I struggle with the mystery of subsetting. Textbook and online examples of this seem quite straightforward yet I cannot get my mind around it. For practice, I'm using the code in MASS Ch. 6, whiteside data to analyze a

Re: [R] using subset() in data frame

2008-02-23 Thread Chuck Cleland
On 2/23/2008 6:09 AM, Chuck Cleland wrote: On 2/22/2008 8:01 PM, Robert Walters wrote: R folks, As an R novice, I struggle with the mystery of subsetting. Textbook and online examples of this seem quite straightforward yet I cannot get my mind around it. For practice, I'm using the code in

Re: [R] using subset() in data frame

2008-02-23 Thread Robert Walters
Erin Hodgess wrote: Hi Robert! Could you please check str(data.b) and see what you have for porosity? It needs to be a factor Thanks, Erin Erin, Yes, porosity is a factor. See output below. str(data.b) 'data.frame': 96 obs. of 7 variables: $ system : Factor w/ 6 levels

Re: [R] using subset() in data frame

2008-02-23 Thread Robert Walters
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)

Re: [R] using subset() in data frame

2008-02-23 Thread Robert Walters
Greg Snow wrote: Look carefully at the output and commands below. The first level of porosity is macro (notice the space at the end) but you are asking for macro (without the space). Computers are very literal, so macro is not equal to macro. T Greg and Chuck, Thanks for your very

Re: [R] using subset() in data frame

2008-02-23 Thread Robert Walters
Chuck Cleland wrote: On 2/23/2008 9:13 AM, Robert Walters wrote: Chuck Cleland wrote: Chuck, For the record, I might add that that the following two variants for subsetting worked equally well: fit1 - lm(pore.pct ~ Db, subset(data.b, porosity == macro )) fit1 - lm(pore.pct ~ Db,

[R] using subset() in data frame

2008-02-22 Thread Robert Walters
R folks, As an R novice, I struggle with the mystery of subsetting. Textbook and online examples of this seem quite straightforward yet I cannot get my mind around it. For practice, I'm using the code in MASS Ch. 6, whiteside data to analyze a different data set with similar variables and