[R] linear fit function with NA values

iza.ch1 iza.ch1 at op.pl
Sat Jul 27 14:47:42 CEST 2013


Hi

Quick question. I am running a multiple regression function for each column of two data sets. That means as a result I get several coefficients. I have a problem because data that I use for regression contains NA. How can I ignore NA in lm function. I use the following code for regression: 
OLS<-lapply(seq_len(ncol(es.w)),function(i) {lm(es.w[,i]~es.median[,i])})
as response I get
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  all values NA

thanks for help :)



More information about the R-help mailing list