Hi


From: Rasmus Hedegaard [mailto:hedegaard_84@hotmail.com]
Sent: Monday, February 25, 2013 2:53 PM
To: PIKAL Petr
Subject: RE: [R] Making the plot window wider and using the predict function

Thank you, Petr - the command

linreg0 <- lm(Hwt ~ Bwt, data = maleData)

works perfectly.

Regarding the second question, I can use the mouse to resize the window, but I was hoping for a piece of code that can do it - so I don't have to resize manually every time I run the code.

See
?devices
and their options width and height. You did not state whot OS do you use.
If you are on windows you can use

windows(w, h)

to set new graphic device (screen) with desired width and height.
With each command you open new device so you need to keep track what do you do to direct output to propper device.

Regards
Petr



Regards,
Rasmus Hedegaard.

> From: petr.pikal@precheza.cz<mailto:petr.pikal@precheza.cz>
> To: hedegaard_84@hotmail.com<mailto:hedegaard_84@hotmail.com>; r-help@r-project.org<mailto:r-help@r-project.org>
> Subject: RE: [R] Making the plot window wider and using the predict function
> Date: Fri, 15 Feb 2013 14:23:46 +0000
>
> Hi
> >
> >
> > Hello,
> >
> > I am new to R and have a couple of questions. My data set contains the
> > variables "Bwt" and "Hwt", which are bodyweight and heartweight,
> > respectively, of a group of cats.
> > With the following code, I am making two plots, both to be viewed in
> > the same plot window in R:
> >
> > library(MASS)
> > maleData <- subset(cats, Sex == "M")
> > linreg0 <- lm(maleData$Hwt ~ maleData$Bwt)
>
> The second question is answered by:
>
> linreg0 <- lm(Hwt ~ Bwt, data=maleData)
>
> after that your predict code works.
>
> > par(mfrow=c(1,2))
> > plot(maleData$Hwt ~ maleData$Bwt)
> > plot(rstandard(linreg0) ~ fitted(linreg0))
> >
> > My problem is that the two plots end up all oblong and squashed,
> > because the plot window doesn't have a size suited for having two plots
> > next to one another. Can I tell R to adjust the plot window?
>
> Can you use mouse for resizing?
>
> Regards
> Petr
>
> >
> > Also, I would like to do something along the lines of:
> >
> > newData <- data.frame(Bwt = 3.5)
> > predict(linreg0,newData,interval="p")
> >
> > This doesn't work - my guess is that to R, "Bwt" is not a variable in
> > maleData, but maleData$Bwt is. I could use an attach command, but is it
> > possible to get this to work without doing so?
> >
> > Kind regards,
> > Rasmus Hedegaard.
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help@r-project.org<mailto: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.

	[[alternative HTML version deleted]]

