如何使用SQL代码在R中创建列名

时间:2018-04-13 15:01:50

标签: r

我正在尝试使用SQL代码在R中列标题。我尝试使用sqldf,但我不断收到语法错误。

install.packages("sqldf")
require(sqldf)
my.data <- read.csv("MDrandom88000.csv")
sqldf("SELECT [Household_ID],[Individual_ID],[Gender],[Date_Of_Birth_Year],[Date_Of_Birth_Month],[age],[Age_Code_Description],[Age_In_Two_Year_HH],[Age_In_Two_Year_Individual],[Ethnic_Code],[Religious_Affiliation],[Rollup_Code],[Language_Preference],[Country_Of_Origin],[Physical_Address_Standardized],[Physical_Address_City],[Physical_Address_State],[Physical_Address_Zip],[Physical_Address_zip4],[Physical_Address_CarrierRoute],[Physical_Address_DeliveryPoint],[Line_Of_Travel],[GeoCode_Results],[GeoCode_Latitude],[GeoCode_Longitude],[Geo_Coded_TimeZoneCode],[Geo_Coded_TimeZone],[Geocode_censustract],[Geo_code_censusblock],[GeoCode_CountyFIPS],[GeoCode_CountyName],[CBSA],[GeoCode_CBSATitle],[Walk_Sequence],[FIPS],[DNC],[Scrubbed_Phoneable],[Charitable],[Animal_Welfare],[Arts_Cultural],[Childrens],[Environment_Wildlife],[Health],[International_Aid],[Political],[Political_Conservative],[Political_Liberal],[Religious],[Veterans],[Commun_involve_Other],[Ailment_Allergy],[Ailment_Arthritis],[Ailment_Diabetic],[Ailment_Disabled],[Ailment_Orthepedic],[Ailment_Senior]
,[Internet_Type],[Business_Owner],[Single_Parent],[Veteran],[Occupation_Individual_Range],[Household_Rank],[Vehicle_New_Used_1],[Vehicle_New_Used_2],[Green_Living],[Number_Children],[Children_Present],[HomeValue_Code],[Home_Value_Description]FROM [Consumer _v0216]. [dbo] .[Consumer_v0216] WHERE Physical_Address_State='MD'")

0 个答案:

没有答案