[R] Compute Regressions with R-Function

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Thu Nov 12 18:37:01 CET 2015


Your email is severely damaged because you sent it using HTML format. Please adjust the settings in your email software to use only plain text when sending to this list so we can see what you see.

While you are at it you should read about making your examples reproducible [1]... it may seem like a pain but you are likely to get better assistance if you make the extra effort before pressing the send button.

(Also, RStudio is a fine way to use R, but many people here use the R interpreter just fine without it so ask all you like about R here but don't assume we are all looking at the same screen you are. If you find you need to refer to RStudio to ask your question then you may be going off-topic. Your current question seems on topic though.)

I don't see a problem with your approach such as I can guess where you are going with it, but your code is messed up and your error does not look like it goes with that code so I have no idea where your actual problem is.

[1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On November 12, 2015 8:27:58 AM PST, Matthias Worni <wornimatthias at gmail.com> wrote:
>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]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list