Hi > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Sam Steingold > Sent: Thursday, August 30, 2012 9:17 PM > To: William Dunlap > Cc: r-help@r-project.org > Subject: Re: [R] apply --> data.frame > > > * William Dunlap <jqha...@gvopb.pbz> [2012-08-30 17:35:08 +0000]: > > > > I don't agree with your analysis of what went wrong with your example > >> a double conversion: from number to string first (by c()) and then > back. > I did not make myself quite clear, sorry. > I should have written something like > c(1,2,"a") ==> "1" "2" "a" =[as.numeric]=> 1 2 "a"
But vector cannot contain values of different mode (character, numeric). There are other structures capable of this. Converting such vector by as numeric inserts NA whenever it encounters non numeric characters. > as.numeric(c(1,2,"a") ) [1] 1 2 NA Warning message: NAs introduced by coercion Regards Petr > > -- > Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X > 11.0.11103000 http://www.childpsy.net/ http://openvotingconsortium.org > http://www.memritv.org http://ffii.org http://truepeace.org > http://palestinefacts.org Those who can't write, write manuals. > > ______________________________________________ > 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. ______________________________________________ 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.