Reading Trip Data CSV Files with Quotes in Col Names and Data

75 views
Skip to first unread message

BHM

unread,
May 10, 2017, 1:46:36 PM5/10/17
to BikeNYC and CitiBikeNYC Hackers
Hi, 

I have downloaded a few zip files from (). Starting from  "https://s3.amazonaws.com/tripdata/201409-citibike-tripdata.zip" the resulting CSV has a strange format. 

"tripduration","starttime","stoptime","start station id","start station name","start station latitude","start station longitude","end station id","end station name","end station latitude","end station longitude","bikeid","usertype","birth year","gender"
"1110","11/1/2015 00:00:00","11/1/2015 00:18:31","537","Lexington Ave & E 24 St","40.74025878","-73.98409214","531","Forsyth St & Broome St","40.71893904","-73.99266288","22545","Subscriber","1981","2"
"1094","11/1/2015 00:00:01","11/1/2015 00:18:15","537","Lexington Ave & E 24 St","40.74025878","-73.98409214","531","Forsyth St & Broome St","40.71893904","-73.99266288","23959","Subscriber","1980","1"
"520","11/1/2015 00:00:05","11/1/2015 00:08:45","536","1 Ave & E 30 St","40.74144387","-73.97536082","498","Broadway & W 32 St","40.74854862","-73.98808416","22251","Subscriber","1988","1"

where every entry and all the col names are quoted. I could not use dput from R language so attaching the input file. 


ATTEMPTS:
I have tried various combinations of read csv in R language, but nothing seems to work. 

This is the closed I could get was this on SO (http://stackoverflow.com/questions/32103639/read-csv-file-in-r-with-double-quotes)

But I am struggling to handle it even then. Any suggestions would be helpful. 


Thanks. 

reduced trip data.csv
Reply all
Reply to author
Forward
0 new messages