Not an answer, but note that your vectors are all first (silently) coerced to character, as vectors must be all of one type.
I would hazard a guess that the answer is: it's simply an arbitrary inconsistency (different folks wrote the functions at different times). Note that AFAICS, the difference has no effect on the behavior of the two functions, i.e. the behavior is consistent, which is what counts. However, I of course defer to real experts. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Nov 21, 2016 at 1:52 AM, Ramnik Bansal <ramnik.ban...@gmail.com> wrote: > Hi, > > I am trying to understand under which specific conditions does explicit > coercion produce warnings. > >> as.numeric(c(1, F, "b")) > [1] 1 NA NA > Warning message: > NAs introduced by coercion > >> as.logical(c(1, F, "b")) > [1] NA FALSE NA > > > In above examples, as.numeric produces warning but as.logical does not. > What is the reason behind this different behaviour. Ideally as.logical > should also have produced the warning message like as.numeric. > > Thanks in advance. > Ramnik > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.