Re: [R] plot xaxp issue

2013-01-08 Thread David Winsemius
On Jan 7, 2013, at 5:02 PM, Elaine Kuo wrote: Hello, I figured out that the code should be boyline<-lm(body_weight ~ body_length, data=subset (together,,sex=="boy")) However, the "" could be omitted if the field name happened to be numeric, such as 1, 2, or 3. Please kindly explain why th

Re: [R] plot xaxp issue

2013-01-07 Thread PIKAL Petr
com] > Sent: Tuesday, January 08, 2013 2:03 AM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: Re: [R] plot xaxp issue > > Hello, > > I figured out that the code should be > > boyline<-lm(body_weight ~ body_length, data=subset > (together,,sex=="boy&q

Re: [R] plot xaxp issue

2013-01-07 Thread Elaine Kuo
Hello, I figured out that the code should be boyline<-lm(body_weight ~ body_length, data=subset (together,,sex=="boy")) However, the "" could be omitted if the field name happened to be numeric, such as 1, 2, or 3. Please kindly explain why the "" could be omitted for numbers. Thanks again. Ela

Re: [R] plot xaxp issue

2013-01-07 Thread Elaine Kuo
Hello, Thanks again. But something wrong with the subset after lm > > It is not about drawing plot many times but coding points or graphic objects > by some factor. In your case sex. > > Instead of > boyline<-lm(body_weight ~ body_length, boy) > > use collective data frame together and subset on

Re: [R] plot xaxp issue

2013-01-07 Thread PIKAL Petr
Hi > -Original Message- > From: Elaine Kuo [mailto:elaine.kuo...@gmail.com] > Sent: Monday, January 07, 2013 1:45 PM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: Re: [R] plot xaxp issue > > Thank you Petr, the code is wonderful. > > One more qu

Re: [R] plot xaxp issue

2013-01-07 Thread Elaine Kuo
Thank you Petr, the code is wonderful. One more question, you used [as.numeric(together$sex)] to drawing plots many times (Par(new)). Please kindly advise if there is a similar method to replace drawing ablines many times. If not, I am afraid that the ablines will not follow the same Y and X-axis

Re: [R] plot xaxp issue

2013-01-07 Thread Elaine Kuo
Thanks a lot. Please kindly indicate the meaning of the c(8,7). > together <- rbind(boy, girl) > together$sex <- factor(rep(c("boy", "girl"), c(8,7))) Elaine On Mon, Jan 7, 2013 at 4:55 PM, PIKAL Petr wrote: > Hi > > Instead of two plots with par(new = TRUE) try to put boys and girls together

Re: [R] plot xaxp issue

2013-01-07 Thread PIKAL Petr
Hi Instead of two plots with par(new = TRUE) try to put boys and girls together (quite natural thing, they will be pleased 8-) together <- rbind(boy, girl) together$sex <- factor(rep(c("boy", "girl"), c(8,7))) plot(together$body_length, together$body_weight, , col=c("firebrick3","saddlebro