R Tips

Home

Contact

Steven Holland

Calling functions by name and position

20 August 2009

> CV <- function(theMean, theSD) {
+ theCV <- theSD / theMean
+ theCV}

> myMean <- 22
> mySD <- 44

> CV(theMean=myMean, theSD=mySD)
[1] 2

> CV(theSD=mySD, theMean=myMean)
[1] 2

> CV(myMean, mySD)
[1] 2

> CV(mySD,myMean)
[1] 0.5