Re: [R] Failed to convert data to numeric

2025-03-03 Thread avi.e.gross
only evaluate any resulting > NA from as.numeric() by doing a substitution like Ivan suggests to try to fix > any broken ones. But note it may fix too much as "1.2 e 5" might become > "1.2e5" as spaces are removed. > > -Original Message- > From: R-h

Re: [R] Failed to convert data to numeric

2025-03-03 Thread Richard O'Keefe
umbers so you may want to carefully document it if your > > program only handles a restricted set. > > > > A possible idea might be to make two passes and only evaluate any > > resulting NA from as.numeric() by doing a substitution like Ivan > > suggests to try to fix any b

Re: [R] Failed to convert data to numeric

2025-03-03 Thread Richard O'Keefe
oing a substitution like Ivan suggests to try to fix > any broken ones. But note it may fix too much as "1.2 e 5" might become > "1.2e5" as spaces are removed. > > -Original Message- > From: R-help On Behalf Of Ivan Krylov via > R-help > Sent:

Re: [R] Failed to convert data to numeric

2025-03-03 Thread Rolf Turner
gt; resulting NA from as.numeric() by doing a substitution like Ivan > suggests to try to fix any broken ones. But note it may fix too much > as "1.2 e 5" might become "1.2e5" as spaces are removed. > > -Original Message- > From: R-help On Behalf Of Ivan Krylov &g

Re: [R] Failed to convert data to numeric

2025-03-03 Thread avi.e.gross
Ivan suggests to try to fix any broken ones. But note it may fix too much as "1.2 e 5" might become "1.2e5" as spaces are removed. -Original Message- From: R-help On Behalf Of Ivan Krylov via R-help Sent: Monday, March 3, 2025 3:09 AM To: Christofer Bogaso Cc: r-help

Re: [R] Failed to convert data to numeric

2025-03-03 Thread Ivan Krylov via R-help
В Mon, 3 Mar 2025 12:08:43 +0530 Christofer Bogaso пишет: > dat2 = c("-24.43728533300", "4.8506950", > "-1.91849566670", > > "2.6418180", "6.77752766670", "3.2080840", > > "4.19328766670", "0.3782577", "4.6589550", > > "-9.881474

Re: [R] Failed to convert data to numeric

2025-03-03 Thread Ivan Krylov via R-help
В Mon, 3 Mar 2025 13:21:31 +0530 Christofer Bogaso пишет: > Is there any way to remove all possible "Unicode character" that may > be present in the array at once? Define a range of characters you consider acceptable, and you'll be able to use regular expressions to remove everything else. For e

Re: [R] Failed to convert data to numeric

2025-03-02 Thread Christofer Bogaso
Hi Ivan, Thanks for your solution. Is there any way to remove all possible "Unicode character" that may be present in the array at once? On Mon, Mar 3, 2025 at 12:18 PM Ivan Krylov wrote: > > В Mon, 3 Mar 2025 12:08:43 +0530 > Christofer Bogaso пишет: > > > dat2 = c("-24.43728533300", "4.8

[R] Failed to convert data to numeric

2025-03-02 Thread Christofer Bogaso
Hi, I have below data dat2 = c("-24.43728533300", "4.8506950", "-1.91849566670", "2.6418180", "6.77752766670", "3.2080840", "4.19328766670", "0.3782577", "4.6589550", "-9.8814740") Now when I try to convert this data to numeric,