[R] promoting scalar arguments to vectors in a function

JLucke at ria.buffalo.edu JLucke at ria.buffalo.edu
Mon May 23 17:59:55 CEST 2016


R users: 

Suppose I have a function that takes three numeric arguments x, y,  and z, 
any of which may be scalars or vectors.
Suppose further that the user takes one of the arguments, say y, as a 
vector with the other two as scalars.
Is there an existing R function that will promote the other two arguments 
to vectors of the same size?

I know in most cases this is not a problem as the promotion is automatic. 
I need this for a function I am writing
and I don't want to write any additional code to do this if I can help it.

Joe
Joseph F. Lucke, PhD
Senior Statistician
Research Institute on Addictions
University at Buffalo
State University of New York
1021 Main Street
Buffalo, NY  14203-1016



	[[alternative HTML version deleted]]



More information about the R-help mailing list