如何从R中的数据库中获取列名

时间:2014-04-19 07:48:38

标签: mysql sql database r

我正在使用sqldf从数据库中的表中获取一些列,但结果没有显示列名,这就是我得到的内容。

我的代码如下:

 z<-sqldf("select (gid, longitude, latitude, acq_date) from kalimantan limit 10" )

和结果

                                                  row 1   
 (1,112.544000000000000,-2.145000000000000,39448) 2  
 (2,111.617000000000000,-2.720000000000000,39448) 3  
 (3,110.277000000000000,-2.554000000000000,39448) 4  
 (4,117.037000000000010,-0.553000000000000,39449) 5  
 (5,117.583000000000000,-0.462000000000000,39454) 6  
 (6,110.292000000000000,-1.517000000000000,39455) 7  
 (7,111.517000000000000,-2.399000000000000,39455) 8  
 (8,110.285000000000000,-2.660000000000000,39455) 9  
 (9,109.527000000000000,-0.219000000000000,39455) 10
 (10,110.756000000000000,-2.727000000000000,39457)

我需要的是

gid  |     longitude         |          latitude           |  date     
 1      112.544000000000000     -2.145000000000000,39448)    1  
 2      111.617000000000000     -2.720000000000000,39448)    2  
 3      110.277000000000000     -2.554000000000000,39448)    3  
 4      117.037000000000010     -0.553000000000000,39449)    4
 5      117.583000000000000     -0.462000000000000,39454)    5  
 6      110.292000000000000     -1.517000000000000,39455)    6  
 7      111.517000000000000     -2.399000000000000,39455)    7  
 8      110.285000000000000     -2.660000000000000,39455)    8
 9      109.527000000000000     -0.219000000000000,39455)    9 
 10     110.756000000000000     -2.727000000000000,39457)    10

0 个答案:

没有答案