[R] run self written functions

Thomas Kuster thomas at fam-kuster.ch
Thu Aug 3 10:46:30 CEST 2006


Am Donnerstag, 3. August 2006 09.36 schrieb Antje:
> 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).

mybmi <- bmi(180, 70)

> 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".

look here (directory R):
auswertung.R is the main file.

> Ciao,
> Antje
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> 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