2016-05-01 18 views
0

私はcoursera講義用のCSVファイルをダウンロードしました。具体的には、固定速度カメラ用のデータをダウンロードしましたhttps://data.baltimorecity.gov/Transportation/Baltimore-Fixed-Speed-Cameras/dz54-2aruCSVファイルをぎこちなく読む

このサイトは、データをきれいにCSV形式で提供しています。 Excelのデータは正常に見えます。しかし、私がRに読んだとき、read.tableを通して、私はちょっとばかげています。

 1. http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> 
    2 <!--[if IE 8]> 
    3  <html xmlns=http://www.w3.org/1999/xhtml xml:lang=en lang=en 
    4   xmlns:v=urn:schemas-microsoft-com:vml 
    5   xmlns:og=http://opengraphprotocol.org/schema/ class=ie ie8 noBorderRadius noLinearGradient noCss3><![endif]--> 
    6 <!--[if gte IE 9]> 
    7  <html xmlns=http://www.w3.org/1999/xhtml xml:lang=en 
    8   xmlns:v=urn:schemas-microsoft-com:vml 
    9   xmlns:og=http://opengraphprotocol.org/schema/ lang=en class=ie><!  
[endif]--> 
    10 <!--[if !IE]>--> 
    11 <html xmlns=http://www.w3.org/1999/xhtml xml:lang=en lang=en 

どこが間違っていましたか?

答えて

1

コードを投稿していないので間違っていた場所を確認するのは難しいですが、csvではなくxmlファイルを開こうとしているようです。あなたがリストしたサイトから「Baltimore_Fixed_Speed_Cameras.csv」をダウンロードしました。単純なCSVとしてエクスポートします。それは本当にちょうどバニラcsvファイルであることを確認するために、プレーンテキストエディタでファイルを開き

data <- read.csv("Baltimore_Fixed_Speed_Cameras.csv", header=T) 

> head(data) 
         address direction  street crossStreet    intersection      Location.1 
1  S CATON AVE & BENSON AVE  N/B Caton Ave Benson Ave  Caton Ave & Benson Ave (39.2693779962, -76.6688185297) 
2  S CATON AVE & BENSON AVE  S/B Caton Ave Benson Ave  Caton Ave & Benson Ave (39.2693157898, -76.6689698176) 
3 WILKENS AVE & PINE HEIGHTS AVE  E/B Wilkens Ave Pine Heights Wilkens Ave & Pine Heights (39.2720252302, -76.676960806) 
4  THE ALAMEDA & E 33RD ST  S/B The Alameda  33rd St  The Alameda & 33rd St (39.3285013141, -76.5953545714) 
5  E 33RD ST & THE ALAMEDA  E/B  E 33rd The Alameda  E 33rd & The Alameda (39.3283410623, -76.5953594625) 
6  ERDMAN AVE & N MACON ST  E/B  Erdman  Macon St   Erdman & Macon St (39.3068045671, -76.5593167803) 

:その後、次のコードでは、Rにインポートするために働きました。

関連する問題