Using capital letters does not improve clarity... it just offends people. Does read.table and friends not do this to your satisfaction already with as.is=TRUE? If not, shouldn't coercing it and checking for NA serve?
--------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnew...@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. Jonathan Greenberg <j...@illinois.edu> wrote: >Given an arbitrary set of character vectors: > >myvect1 <- c("abc","3","4") >myvect2 <- c("2","3","4") > >I would like to develop a function that will convert any vectors that >can >be PROPERLY converted to a numeric (myvect2) into a numeric, but leaves >character vectors which cannot be converted (myvect1) alone. Is there >any >simple way to do this (e.g. some function that tests if a vector is >coercible to a numeric before doing so)? > >--j ______________________________________________ R-help@r-project.org mailing list 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.