2016-10-04 5 views
0

Rを使用してRODBCパッケージでデータをインポートしています。私がテーブル名にアクセントを付けたExcelファイルを使用していて、スプレッドシートの名前を手動で変更せずにデータをインポートする方法を理解する必要があるという問題。テーブルにRODBCでアクセント記号が付いているデータをインポートする

以下

は、問題の再現可能な例である:

download.file("http://www.secretariadoejecutivo.gob.mx/docs/datos_abiertos/Datos_abiertos_Victimas_Fuero_comun.xls", 
      destfile="./Victimas_Fuero_comun.xls", 
      mode = "wb") 

library(RODBC) 

filePath <- "./Victimas_Fuero_comun.xls" 
channel <- odbcConnectExcel2007(filePath) 
sqlTables(channel) 
DatosAbiertosVictimasFuero <- sqlFetch(channel, 
          "Datos_abiertos_Víctimas_Fuero_c") # accent in 'Víctimas' 
odbcClose(channel) 
str(DatosAbiertosVictimasFuero) 


sessionInfo() 

R version 3.3.0 (2016-05-03) 
Platform: x86_64-w64-mingw32/x64 (64-bit) 
Running under: Windows 7 x64 (build 7601) Service Pack 1 

locale: 
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C        LC_TIME=English_United States.1252  

attached base packages: 
[1] stats  graphics grDevices utils  datasets methods base  

other attached packages: 
[1] RODBC_1.3-13 

答えて

0

これは

library(readxl) 

filePath <- "./Victimas_Fuero_comun.xls" 


data <- read_excel(filePath, sheet = 1) 
を働いた
関連する問題