Dear Tim, So there is no way to coerce "09098" to 09098? Yours sincerely, AKSHAY M KULKARNI ________________________________ From: Ebert,Timothy Aaron <tebert at ufl.edu> Sent: Monday, September 12, 2022 12:07 AM To: akshay kulkarni <akshay_e4 at hotmail.com>; R help Mailing list <r-help at r-project.org> Subject: RE: inadequacy in as.integer.... Keep as character. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of akshay kulkarni Sent: Sunday, September 11, 2022 12:22 PM To: R help Mailing list <r-help at r-project.org> Subject: [R] inadequacy in as.integer.... [External Email] Dear members, I came across this queer thing during my analysis:> as.integer("09098")Any idea on how to retain the "0"? Yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FV4NoU8j%2F9KIYX5ExaY93fwQf%2FPqx1kisbt87Mj9%2F7Q%3D&reserved=0 PLEASE do read the posting guide https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BA0o8oGcR%2FFBX9Vth5DuitlZnTGG7rNDmFga3ixZ9j4%3D&reserved=0 and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]
What you're asking for doesn't make sense: 9098 and 09098 are the same 9098L == 09098L If you mean specifically while printing, you could use sprintf: cat(sprintf("%05d", 9098)) On Sun., Sep. 11, 2022, 14:58 akshay kulkarni, <akshay_e4 at hotmail.com> wrote:> Dear Tim, > So there is no way to coerce "09098" to 09098? > > Yours sincerely, > AKSHAY M KULKARNI > ________________________________ > From: Ebert,Timothy Aaron <tebert at ufl.edu> > Sent: Monday, September 12, 2022 12:07 AM > To: akshay kulkarni <akshay_e4 at hotmail.com>; R help Mailing list < > r-help at r-project.org> > Subject: RE: inadequacy in as.integer.... > > Keep as character. > > Tim > > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of akshay kulkarni > Sent: Sunday, September 11, 2022 12:22 PM > To: R help Mailing list <r-help at r-project.org> > Subject: [R] inadequacy in as.integer.... > > [External Email] > > Dear members, > I came across this queer thing during my > analysis: > > as.integer("09098") > > > Any idea on how to retain the "0"? > > Yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FV4NoU8j%2F9KIYX5ExaY93fwQf%2FPqx1kisbt87Mj9%2F7Q%3D&reserved=0 > PLEASE do read the posting guide > https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BA0o8oGcR%2FFBX9Vth5DuitlZnTGG7rNDmFga3ixZ9j4%3D&reserved=0 > and provide commented, minimal, self-contained, reproducible code. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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. >[[alternative HTML version deleted]]
Can you tell us why you want to do this? Is there something special about 09098 versus 9098 or 0000009098? In any mathematical operation these are all the same number. Tim From: akshay kulkarni <akshay_e4 at hotmail.com> Sent: Sunday, September 11, 2022 2:58 PM To: Ebert,Timothy Aaron <tebert at ufl.edu>; R help Mailing list <r-help at r-project.org> Subject: Re: inadequacy in as.integer.... [External Email] Dear Tim, So there is no way to coerce "09098" to 09098? Yours sincerely, AKSHAY M KULKARNI ________________________________ From: Ebert,Timothy Aaron <tebert at ufl.edu<mailto:tebert at ufl.edu>> Sent: Monday, September 12, 2022 12:07 AM To: akshay kulkarni <akshay_e4 at hotmail.com<mailto:akshay_e4 at hotmail.com>>; R help Mailing list <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: RE: inadequacy in as.integer.... Keep as character. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org<mailto:r-help-bounces at r-project.org>> On Behalf Of akshay kulkarni Sent: Sunday, September 11, 2022 12:22 PM To: R help Mailing list <r-help at r-project.org<mailto:r-help at r-project.org>> Subject: [R] inadequacy in as.integer.... [External Email] Dear members, I came across this queer thing during my analysis:> as.integer("09098")9098 Any idea on how to retain the "0"? Yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=%2FV4NoU8j%2F9KIYX5ExaY93fwQf%2FPqx1kisbt87Mj9%2F7Q%3D&reserved=0<https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C6a2c6801bcbf4bf0e6f708da94278655%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985194721617829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=IimcrUXv0HF%2F2FyD5S699dgqmGAZe5%2FKcRqHTiHDyvE%3D&reserved=0> PLEASE do read the posting guide https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C70a6ae074d1e42c17e9108da9411d934%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985101625267716%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BA0o8oGcR%2FFBX9Vth5DuitlZnTGG7rNDmFga3ixZ9j4%3D&reserved=0<https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C6a2c6801bcbf4bf0e6f708da94278655%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C637985194721617829%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=HQmvbdpGZj4Mt64EwTre5pdzE9xHJ8mdWHN8c%2Fye3CY%3D&reserved=0> and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]]