plotGoogleMaps with factor variable

19 views
Skip to first unread message

abhishek kapoor

unread,
Jan 22, 2014, 1:59:07 AM1/22/14
to r-grou...@googlegroups.com
Hi Grp members, 

is it possible to plot map using factor variable? 

I am trying to plot ATMs, Hospital, and restaurant location (Lat/Long) and with address but i m not getting desired result. 

Below is the code 

  
eq <- read.csv ('C:/Users/abc/Desktop/2013_08_01_NCR_Master.csv') 
str (eq) 

'data.frame':   13430 obs. of  6 variables: 
 $ Type       : Factor w/ 3 levels "ATM","Hospital",..: 2 2 2 2 2 2 2 2 2 2 ... 
 $ Lat        : num  28.5 28.5 28.4 28.6 28.7 ... 
 $ Lng        : num  77 77 77 77 77 ... 
 $ PhoneNumber: Factor w/ 5562 levels "","0","011 2004 4406",..: 4922 1 2610 1 1 2669 1 2652 1 4075 ... 
 $ Address    : Factor w/ 13394 levels "???, IGI Airport T3 Road, IGI Airport, New Delhi, DL",..: 11064 11071 13208 9306 12497 2644 10809 9722 6499 12089 ... 
 $ Type1      : int  2 2 2 2 2 2 2 2 2 2 ... 

coordinates(eq) = ~Lng + Lat 
proj4string(eq) = CRS("+proj=longlat +datum=WGS84") 
eq <- SpatialPointsDataFrame( eq , data = data.frame( id = row.names( eq ) ) ) 

ma<-plotGoogleMaps(eq,zcol="Type", colPalette=c("#FFF7BC", "#FEC44F","#D95F0E"),filename='myMap82.html',mapTypeId= 'TERRAIN', fitBounds=T) 

but it is not producing desired results 
I want only 3 color bubbles by "Type" - ATM, Hospital & Restaurants 

I hope you can help me, this is my first time in R. 

I am using Windows and R is 3.0.2 
Thanks in advance 

Regards 
Abhishek

A. Mani

unread,
Jan 23, 2014, 11:14:49 AM1/23/14
to r-grou...@googlegroups.com
On Wed, Jan 22, 2014 at 12:29 PM, abhishek kapoor <kapo...@gmail.com> wrote:
> $ Type : Factor w/ 3 levels "ATM","Hospital",..: 2 2 2 2 2 2 2 2 2 2 ...
> ...

what is this?

there is some problem with reading data.


Best

A. Mani



A. Mani
[Last_Name. First_Name Format]
CU, ASL, AMS, ISRS, CLC, CMS
HomePage: http://www.logicamani.in
Blog: http://logicamani.blogspot.in/
Reply all
Reply to author
Forward
0 new messages