Thanks to all who responded.
I've learn a lot from your comments. The best solution I can see is to use both
'missing()' and
'match.arg()' in my function.
Héctor
Hi,
I'm sure this one is very easy
I am trying to write a function where one of its arguments has two posible
(strings)
Hi,
I'm sure this one is very easy
I am trying to write a function where one of its arguments has two posible
(strings) values,
defaulting to one of them if none is specified. My problem is that when
evaluating the function
the following warning is produced:
the condition has length 1
Look at what happens when you don't pass in 'result':
c('simple', 'complete') %in% c(simple, s, complete, c)
[1] TRUE TRUE
result is a vector of length two and provides two results and the 'if'
was only expecting one. You might have to debug your code some more.
You probably want to use
-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Héctor Villalobos
Sent: Wednesday, 20 January 2010 10:34 a.m.
To: R-help@r-project.org
Subject: [R] coping with a warning in if()
Hi,
I'm sure this one is very easy
I am trying to write a function where one of its
Héctor Villalobos hvillalo at ipn.mx writes:
Hi,
I'm sure this one is very easy
I am trying to write a function where one of its arguments has two posible
(strings) values,
defaulting to one of them if none is specified. My problem is that when
evaluating the function
the
5 matches
Mail list logo