a) Please post in plain text.
b) Although you mention Excel, it does not seem to be relevant. (This is
a good thing, but mentioning it is a red herring.)
c) Your definition of X is not executable R code. If you have already
imported data from elsewhere, you can use dput to make it easy for us to
read it in (essentially) exactly as you have it loaded in your memory. I
have assumed that you have a vector of strings that you failed to give us.
d) Quoting your variable X is not right. Rather you should index it. See
below.
On Sun, 25 Nov 2012, ioanna ioannou wrote:
> Hello,
>
> A very simple question but I am stuck. I have an excel file each row is an
> address. However, I cannot make geocode read each line and come up with the
> latitude longitude. Could you please correct my code?
>
>
> library(ggmap)
>
> X<-c (2 Afxentiou Ampelokipi Thessaloniki Greece, 2 Afxentiou Ampelokipi
> Thessaloniki Greece, 4 Afxentiou Ampelokipi Thessaloniki Greece, 55
> Agathonos Ampelokipi Thessaloniki Greece)
>
> For (i in 1:4){
>
> Y<-geocode('X')
Y[i] <- geocode(X[i])
> print Y[i]
>
> }
Or better yet, eliminate the entire for loop and just give geocode the
whole vector:
Y <- geocode( X )
Then see what is in Y:
Y
> Best wishes,
>
> Ioanna
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k