В Mon, 3 Mar 2025 12:08:43 +0530
Christofer Bogaso <[email protected]> пишет:
> dat2 = c("-24.437285333333300", "4.850695000000000",
> "-1.918495666666670",
>
> "2.641818000000000", "6.777527666666670", "3.208084000000000",
>
> "4.193287666666670", "0.378257666666667", "4.658955000000000",
>
> "-9.881474000000000")
>
> Now when I try to convert this data to numeric, I got NA as below
>
> > as.numeric(dat2)
>
> [1] -24.4372853 4.8506950 -1.9184957 2.6418180 6.7775277
> 3.2080840
>
> [7] 4.1932877 0.3782577 4.6589550 NA
There's an invisible Unicode character in there, U+FEFF ZERO WIDTH
NO-BREAK SPACE:
> dat2 |> tail(1) |> tools::showNonASCII()
1: <ef><bb><bf>-9.881474000000000
Try as.numeric(gsub('\ufeff', '', dat2)).
--
Best regards,
Ivan
______________________________________________
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.