[R] How to get the input of a function right?

Robert Baer rbaer at atsu.edu
Sun Mar 25 19:52:07 CEST 2012

Your definition of x1, x2 and x3 requires the c() function.  Try leaving 
some space around operators for increased readability.

Remember that the that the result of operations on sets containing NA is 
often set to "NA" as well.  My guess is that if you print out x it contains 
NA and that your function does operations on x that are included in the 
function result.


-----Original Message----- 
From: stella
Sent: Thursday, March 22, 2012 10:43 AM
To: r-help at r-project.org
Subject: [R] How to get the input of a function right?


I wrote a function with three inputs fun(x,y,z).

x is a matrix of three vectors combined with cbind. e.g.



y is a vector e.g

z is a real number e.g.

If a give the function an input like this, I get 'NA' in return. If I give
the function a vector e.g c(1,2,3) instead of 'x' the function works just
Does anyone has an idea why the function would not except 'x' as an input?

Thank you very much!

View this message in context: 
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
FAX 660-626-2965 

More information about the R-help mailing list