Re: [R] linear fit function with NA values

2013-07-27 Thread arun
.2.2 loaded via a namespace (and not attached): [1] plyr_1.8    tools_3.0.1 BTW, It is better to ?dput() the example dataset. A.K. - Original Message - From: iza.ch1 To: arun Cc: R help Sent: Saturday, July 27, 2013 4:46 PM Subject: Re: Re: [R] linear fit function with NA values Hi

Re: [R] linear fit function with NA values

2013-07-27 Thread iza.ch1
Hi Thanks for your hints. I would like to describe my problem better and give an examle of the data that I use. I conduct the event study and I need to create abnormal returns for the daily stock prices. I have for each stock returns from time period of 8 years. For some days I don't have the

Re: [R] linear fit function with NA values

2013-07-27 Thread arun
HI, set.seed(28) dat1<- as.data.frame(matrix(sample(c(NA,1:20),100,replace=TRUE),ncol=10)) set.seed(49) dat2<- as.data.frame(matrix(sample(c(NA,40:80),100,replace=TRUE),ncol=10))  lapply(seq_len(ncol(dat1)),function(i) {lm(dat2[,i]~dat1[,i])}) #works bcz the default setting removes NA Regarding