[R] named character question
arun
smartpink111 at yahoo.com
Mon Aug 13 06:00:13 CEST 2012
HI,
Try this:
add11<-strsplit(add1,split=",")
gsub("TX","",add11[[1]][3])
#[1] " 77076"
A.K.
----- Original Message -----
From: Erin Hodgess <erinm.hodgess at gmail.com>
To: R help <r-help at stat.math.ethz.ch>
Cc:
Sent: Sunday, August 12, 2012 11:33 PM
Subject: [R] named character question
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.hodgess at gmail.com
______________________________________________
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.
More information about the R-help
mailing list