Re: [R] Changing Date Variables as Continuous Variables

2012-11-03 Thread Rolf Turner
There is a phenomenon that occurs here which, it seems to me, merits some emphasis. The glm() function appears to be perfectly willing to take a variable of class "Date" and treat it as a continuous variable. Apparently what it does (on the basis of one little experiment that I did) is convert

Re: [R] Changing Date Variables as Continuous Variables

2012-11-03 Thread jim holtman
Here is how to convert your column of factors into Dates: > x <- read.table(text = '2/10/2011 + 2/20/2011 + 3/4/2011') > # read in as factors > str(x) 'data.frame': 3 obs. of 1 variable: $ V1: Factor w/ 3 levels "2/10/2011","2/20/2011",..: 1 2 3 > # convert to Date > x$date <- as.Date(as.chara

[R] Changing Date Variables as Continuous Variables

2012-11-03 Thread hoguejm
I am very new to R, so I apologize if this question is trivial. I have a row in my data of dates in the format mm/dd/; about 3500 rows. I am using this variable in a logistic regression model, and need to treat it as continuous, not a factor as r has decided it is. I tried the as.numeric fu