Sachinthaka Abeywardana
2014-Apr-09 06:11 UTC
[R] Not able to convert data.frame to numeric properly
I have the following:>a #note that the 28 is a row.nameGHP GP T Tn 28 2.2194 2.6561 2.9007 3.2988>min(as.numeric(a))2.9007>min(as.numeric(as.character(a)))2.9007>as.numeric(as.character(a)) #What's going on here???[1] 33.0000 29.0000 2.9007 3.2988 So basically how do I get this to show the correct value of 2.21 as my minimum value? Thanks, Sachin
Frede Aakmann Tøgersen
2014-Apr-09 06:17 UTC
[R] Not able to convert data.frame to numeric properly
We can't say because we don't know how a was created. Please email the output from str(a) and dput(a) Yours sincerely / Med venlig hilsen Frede Aakmann T?gersen Specialist, M.Sc., Ph.D. Plant Performance & Modeling Technology & Service Solutions T +45 9730 5135 M +45 2547 6050 frtog at vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender.> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of Sachinthaka Abeywardana > Sent: 9. april 2014 08:11 > To: r-help at r-project.org > Subject: [R] Not able to convert data.frame to numeric properly > > I have the following: > > > >a #note that the 28 is a row.name > > GHP GP T Tn > 28 2.2194 2.6561 2.9007 3.2988 > > >min(as.numeric(a)) > 2.9007 > >min(as.numeric(as.character(a))) > 2.9007 > >as.numeric(as.character(a)) #What's going on here??? > [1] 33.0000 29.0000 2.9007 3.2988 > > So basically how do I get this to show the correct value of 2.21 as my > minimum value? > > Thanks, > Sachin > > ______________________________________________ > R-help at 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.