Basic Multivariate Regression Analysis with R

I'm trying to look for simple patterns in weather data. Here's a simplified version of what I'm working with.

day <- c(4, 5, 6, 8)
temp <- c(97, 100, 98, 80)
humidity <- c(62, 46, 50, 55)


Suppose I wanted to predict the temperature on day 7 and day 9 (neither are listed) using the following factors. Which R command would I use to do this?

I know how do predictions using 2 variables.

fit <- lm(temp ~ day)
newdat <- data.frame( day=c(7,9) )
predict(fit, newdat)


But how would I go about using more than 2?

Your help would be greatly appreciated.

-
It is much easier to use the predict function in R. First create a new data frame with a column named day with the values that you want to predict for, then pass that along with the fitted model to the predict function. It is important that the new data frame has columns with the exact same names as the original variables:
newdat <- data.frame( day=c(7,9) )

See ?formula for the details on how to specify the formulas for various linear models. The short is that you would use lm( humidity~temp+day) or lm(humidity~humidity*day) depending on whether you want an interaction or not. –  Greg Snow Jul 5 '12 at 2:23