本地配置 UTF-8 或任何读取重音符号的配置
一直在尝试加载包含重音符号的文件夹内的 Excel 文件,但未能成功。
通过正常过程,我收到以下错误:
ent \<- "2. En proceso/IPP 120-01-2022 Reglamento Ferroviario/Datos/"
df \<- read_xls(paste0(ent, "Contratos2022_2203220927", ".xlsx"))
Error: filepath: C:\\Users\\paulo\\OneDrive - El Colegio de México A.C\\2. Diputados\\1. Con impacto\\2. En proceso\\IPP 120-01-2022 Reglamento Ferroviario\\Datos\\Contratos2022_2203220927.xlsx libxls error: Unable to open file
问题似乎出在“México”一词中。尝试解决问题
ent <- Sys.glob(paste0(getwd(), "/", "2. En proceso/IPP 120-01-2022 Reglamento Ferroviario/Datos/"))
df \<- read_xls(paste0(ent, "Contratos2022_2203220927", ".xlsx"))
但随后我收到以下消息:
Error: filepath: C:\Users\paulo\OneDrive - El Colegio de México A.C\2. Diputados\1. Con impacto\2. En proceso\IPP 120-01-2022 Reglamento Ferroviario\Datos\Contratos2022_2203220927.xlsx libxls error: Unable to open file
尽管口音已修复,但问题仍然存在。
尝试使用不同的文件编码(Windows-1252 和 UFT-8)运行代码,但没有任何效果。我的区域设置配置是:
> Sys.getlocale()
> \[1\] "LC_COLLATE=Spanish_Mexico.1252;LC_CTYPE=Spanish_Mexico.1252;LC_MONETARY=Spanish_Mexico.1252;LC_NUMERIC=C;LC_TIME=Spanish_Mexico.1252"
Have been trying to load an Excel file that is inside a folder that contains an accent but have not been able to do it.
Thorugh the normal process, I get the following Error:
ent \<- "2. En proceso/IPP 120-01-2022 Reglamento Ferroviario/Datos/"
df \<- read_xls(paste0(ent, "Contratos2022_2203220927", ".xlsx"))
Error: filepath: C:\\Users\\paulo\\OneDrive - El Colegio de México A.C\\2. Diputados\\1. Con impacto\\2. En proceso\\IPP 120-01-2022 Reglamento Ferroviario\\Datos\\Contratos2022_2203220927.xlsx libxls error: Unable to open file
The problem seems to be in the word "México". Tried to solve the problem with
ent <- Sys.glob(paste0(getwd(), "/", "2. En proceso/IPP 120-01-2022 Reglamento Ferroviario/Datos/"))
df \<- read_xls(paste0(ent, "Contratos2022_2203220927", ".xlsx"))
But then I get the following message:
Error: filepath: C:\Users\paulo\OneDrive - El Colegio de México A.C\2. Diputados\1. Con impacto\2. En proceso\IPP 120-01-2022 Reglamento Ferroviario\Datos\Contratos2022_2203220927.xlsx libxls error: Unable to open file
Although the accent is fixed, the problem persists.
Have tried to run the code with different file encodings (Windows-1252 & UFT-8) but nothing works. My locale configuration is:
> Sys.getlocale()
> \[1\] "LC_COLLATE=Spanish_Mexico.1252;LC_CTYPE=Spanish_Mexico.1252;LC_MONETARY=Spanish_Mexico.1252;LC_NUMERIC=C;LC_TIME=Spanish_Mexico.1252"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论