Displaying 1 result from an estimated 1 matches for "mylats".
Did you mean:
mylast
2012 Oct 26
1
using match-type function to return correctly ordered data from a dataframe
...ion that I missed in all my googling.
Thanks in advance for anybody's help figuring this out.
~Markus
### Function Definitions ###
# FUNCTION #1 (returns wrong order)
getLatitude1 = function(myzips) {
# load libraries and data
library(zipcode)
data(zipcode)
# get latitude values
mylats = zipcode[zipcode$zip %in% myzips, "latitude"] #problem is that
this code does not maintain order
# return data
return(mylats)
}
# FUNCTION #2 (also returns wrong order)
getLatitude2 = function(myzips) {
# load libraries and data
library(zipcode)
data(zipcode)
# convert my...