[R] linear regression with dates
Daniel Nordlund
djnordlund at frontier.com
Tue Dec 28 00:23:53 CET 2010
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Entropi ntrp
> Sent: Monday, December 27, 2010 3:05 PM
> To: r-help at r-project.org
> Subject: [R] linear regression with dates
>
> Hi,
> I am trying to do simple linear regression using dates in R but receiving
> error messages. With the data shown below, I would like to regress x on y.
>
> x y
> 11/12/1999 56.8 11/29/1999 17.9 01/04/2000 27.4 1/14/2000 96.8
> 1/31/2000 49.5
> R gives the following error messages after reading the linear regression
> command:
>
> Error in storage.mode(y) <- "double" :
> invalid to change the storage mode of a factor
> In addition: Warning message:
> In model.response(mf, "numeric") :
> using type="numeric" with a factor response will be ignored
>
> Can someone explain me how to resolve this issue?
>
> I appreciate your help in advance.
>
You really need to follow the posting guide and give a self-contained, reproducible example if you expect to receive useful help. You haven't shown us the code you tried to execute, and we don't know where your data came from. The error message suggests that your data isn't what you think it is.
So, if this data is in a data frame, then show us the results of
str(your data frame)
Also, show us the actual regression call.
Dan
Daniel Nordlund
Bothell, WA USA
More information about the R-help
mailing list