[R] run self written functions

Antje niederlein-rstat at yahoo.de
Thu Aug 3 09:36:58 CEST 2006


Hello,

I'm not sure if I'm in the right place with my question...
I'm running R on Windows and wrote a function and saved it as .R file.
It looks like this:

bmi <- function(weight, height) {
    bmi <- weight / height^2
    bmi
}

If I want to use this function, I have to mark everything and then press 
Ctrl-R. But then everything single line is executed on the command line, 
which means that I will "loose" my history when the code becomes longer.
Further, I wonder if there is any way to do some output for control 
within the function (or any other possibilities to debug in a way).

Maybe, I have chosen a completely wrong way? I only want to make it easy 
to create some graphical visualizations of data which will be read in by 
csv. files, has to be converted and then displayed depending on some 
"displaying parameters".

Ciao,
Antje



More information about the R-help mailing list