[R] Compute Regressions with R-Function

Matthias Worni wornimatthias at gmail.com
Thu Nov 12 17:27:58 CET 2015


Hello

I was trying to set up a function() that allows easely to calculate
regressions for severel dependent variables with the same independent
variables.

My function looked like this but was turned down by an error (Im quiet new
to R Studio). So here is my solution:

b
CO2
logTrop_Aerosol
lm(b ~ CO2  + logTrop_Aerosol  )

Trend <- function(x,CO2,logTrop_Aerosol) { lm x   CO2  + logTrop_Aerosol}

b is a vector containing 400 values of heat content
CO2 also contains 400 values as well as logTropAerosol

my idea would be that I simply can replace x (heat content) by other
vectors containing heat content.

The error I got was the following:

Error: unexpected symbol in "Trend <- function(x,y,z) { lm x"

Thanks a lot for the help!

Best Matthias

	[[alternative HTML version deleted]]



More information about the R-help mailing list