Hi Erin, The first element of the character vector is a string. You cannot extract specifically characters from a string; try something like ?nchar
or perhaps better use regular expressions to extract things between commas after two characters (or whatever logical rule accurately gets the zip code). Cheers, Josh On Sun, Aug 12, 2012 at 8:33 PM, Erin Hodgess <erinm.hodg...@gmail.com> wrote: > Dear R People: > > Here is a goofy question: > > I want to extract the zip code from an address and here is my work so far: > >> add1 > results.formatted_address > "200 W Rosamond St, Houston, TX 77076, USA" >> add1[1][32:36] > <NA> <NA> <NA> <NA> <NA> > NA NA NA NA NA >> str(add1) > Named chr "200 W Rosamond St, Houston, TX 77076, USA" > - attr(*, "names")= chr "results.formatted_address" >> > > What am I not seeing, please? > > Thanks, > Erin > > > -- > Erin Hodgess > Associate Professor > Department of Computer and Mathematical Sciences > University of Houston - Downtown > mailto: erinm.hodg...@gmail.com > > ______________________________________________ > R-help@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. -- Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/ ______________________________________________ R-help@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.