Skip to content
Prev 286840 / 398502 Next

linear regression by column

On Feb 29, 2012, at 1:53 PM, Filoche wrote:

            
apply( DF[2:5], 2, function(x){lm(DF[,1] ~ x)})

You need to use the variable name that you created in the function  
call and loop over columns, not rows.
For about four or five reasons.
David Winsemius, MD
West Hartford, CT