Brilliant, thanks very much!! Works fine.

Dan
On 6 Dec 2012, at 18:25, arun kirshna [via R] wrote:

> Hi, 
> Your question is not very clear.  I hope you are not looking for the subset 
> option in summary(lm()). 
> If you want just the summary(),  then use '&' or '|' 
> For e.g. 
> dat1<-read.table(text=" 
> opcorn   Oilamt   Batch        Yield 
> plain       little          large              8.2 
> gourmet     little          large              8.6 
> plain       lots            large            10.4 
> gourmet     lots            large              9.2 
> plain       little          small         9.9 
> gourmet    little           small            12.1 
> plain       lots            small       10.6 
> gourmet    lots             small            18.0 
> plain       little          large            8.8 
> gourmet    little           large        8.2 
> plain       lots            large            8.8 
> gourmet    lots             large        9.8 
> plain      little           small           10.1 
> gourmet   little           small           15.9 
> plain     lots             small        7.4 
> gourmet   lots             small           16.0 
> ",sep="",header=TRUE) 
> dat1$Yield[dat1$opcorn=="gourmet"&dat1$Oilamt=="lots"] 
> #[1]  9.2 18.0  9.8 16.0 
>  summary(dat1$Yield[dat1$opcorn=="gourmet"&dat1$Oilamt=="lots"]) 
> #   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
> #   9.20    9.65   12.90   13.25   16.50   18.00 
>  summary(dat1$Yield[dat1$opcorn=="gourmet"|dat1$Oilamt=="lots"]) 
> #   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
>   # 7.40    8.75   10.10   11.25   13.05   18.00 
> A.K. 
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://r.789695.n4.nabble.com/Summary-command-Two-independent-variables-against-dependent-tp4652326p4652404.html
> To unsubscribe from Summary command: Two independent variables against 
> dependent., click here.
> NAML





--
View this message in context: 
http://r.789695.n4.nabble.com/Summary-command-Two-independent-variables-against-dependent-tp4652326p4652405.html
Sent from the R help mailing list archive at Nabble.com.
        [[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.

Reply via email to