[R] How to fix the warning message "the condition has length > 1 and only the first element will be used"?
Franklin Bretschneider
bretschr at xs4all.nl
Thu Mar 20 00:33:59 CET 2014
Hi jcrosbie ,
Re:
> I'm trying to create a function to return the date x months in the past.
>
> With the code below I'm getting the warning message:
>
> Warning message:
> In if (MonthsBack >= CurrentMonth) { :
> the condition has length > 1 and only the first element will be used
>
Use ifelse(), that's for vectors. "If" is intended for single elements only.
Best wishes,
Franklin
-
Franklin Bretschneider
Dept of Biology
Utrecht University
bretschr at xs4all.nl
More information about the R-help
mailing list