答案 0 :(得分:2)
以下是使用Baltimore City Employee Salary数据读取CSV文件的示例。
#
# City of Baltimore 2016 employee salary data
#
theFile <- "https://data.baltimorecity.gov/api/views/65ac-s4v5/rows.csv?accessType=DOWNLOAD"
download.file(theFile,
"./data/baltimoreEmployeeSalaries2016.csv",
method="wininet", # for Windows, use "curl" for OS X / Linux
mode="w")
salaries <- read.csv("./data/baltimoreEmployeeSalaries2016.csv",header=TRUE,stringsAsFactors=FALSE)
head(salaries)
...和输出。
> head(salaries)
Name JobTitle AgencyID Agency HireDate
1 Aaron,Patricia G Facilities/Office Services II A03031 OED-Employment Dev (031) 10/24/1979 12:00:00 AM
2 Aaron,Petra L ASSISTANT STATE'S ATTORNEY A29045 States Attorneys Office (045) 09/25/2006 12:00:00 AM
3 Abbey,Emmanuel CONTRACT SERV SPEC II A40001 M-R Info Technology (001) 05/01/2013 12:00:00 AM
4 Abbott-Cole,Michelle Operations Officer III A90005 TRANS-Traffic (005) 11/28/2014 12:00:00 AM
5 Abdal-Rahim,Naim A EMT Firefighter Suppression A64120 Fire Department (120) 03/30/2011 12:00:00 AM
6 Abdelmeguid,Shahrazad CONTRACT SERV SPEC II A29010 States Attorneys Office (010) 11/30/2015 12:00:00 AM
AnnualSalary GrossPay
1 $56705.00 $54135.44
2 $75500.00 $72445.87
3 $60060.00 $59602.58
4 $70000.00 $59517.21
5 $64365.00 $74770.82
6 $40019.00 $16283.26
>
此时,您可以使用write.xport(salaries,...)
生成SAS导出文件。